Skip to content

Commit

Permalink
refactor!: Rename required_status_checks.contexts to required_status_…
Browse files Browse the repository at this point in the history
…checks.checks as contexts is depcrecated
  • Loading branch information
soerenmartius committed Feb 3, 2023
1 parent f7aaf46 commit 78d3197
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- BREAKING CHANGE: Bump minimum supported version of the GitHub provider to `v5.16`
as it contains a [critical fix](https://github.com/integrations/terraform-provider-github/pull/1415) for branch protections.
- BREAKING CHANGE: Rename `required_status_checks.contexts` to `required_status_checks.checks` as contexts is depcrecated

## [0.18.0]

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ This is due to some terraform limitation and we will update the module once terr

Default is `false`.

- [**`contexts`**](#attr-branch_protections_v3-required_status_checks-contexts): *(Optional `list(string)`)*<a name="attr-branch_protections_v3-required_status_checks-contexts"></a>
- [**`checks`**](#attr-branch_protections_v3-required_status_checks-checks): *(Optional `list(string)`)*<a name="attr-branch_protections_v3-required_status_checks-checks"></a>

The list of status checks to require in order to merge into this branch. If default is `[]` no status checks are required.

Expand Down Expand Up @@ -749,7 +749,7 @@ This is due to some terraform limitation and we will update the module once terr

Default is `false`.

- [**`contexts`**](#attr-branch_protections_v4-required_status_checks-contexts): *(Optional `list(string)`)*<a name="attr-branch_protections_v4-required_status_checks-contexts"></a>
- [**`checks`**](#attr-branch_protections_v4-required_status_checks-checks): *(Optional `list(string)`)*<a name="attr-branch_protections_v4-required_status_checks-checks"></a>

The list of status checks to require in order to merge into this branch. If default is `[]` no status checks are required.

Expand Down
4 changes: 2 additions & 2 deletions README.tfdoc.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ section {
END
}

attribute "contexts" {
attribute "checks" {
type = list(string)
default = []
description = <<-END
Expand Down Expand Up @@ -967,7 +967,7 @@ section {
END
}

attribute "contexts" {
attribute "checks" {
type = list(string)
default = []
description = <<-END
Expand Down
2 changes: 1 addition & 1 deletion examples/public-repository/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module "repository" {
required_status_checks = {
strict = true
contexts = ["ci/travis"]
checks = ["ci/travis"]
}
required_pull_request_reviews = {
Expand Down
2 changes: 1 addition & 1 deletion examples/public-repository/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module "repository" {

admin_collaborators = ["terraform-test-user-1"]

branch_protections = [
branch_protections_v5 = [
{
branch = "main"
enforce_admins = true
Expand Down
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ locals {
for b in local.branch_protections_v3 :
length(keys(b.required_status_checks)) > 0 ? [
merge({
strict = null
contexts = []
strict = null
checks = []
}, b.required_status_checks)] : []
]

Expand Down Expand Up @@ -260,8 +260,8 @@ resource "github_branch_protection_v3" "branch_protection" {
for_each = local.required_status_checks[count.index]

content {
strict = required_status_checks.value.strict
contexts = required_status_checks.value.contexts
strict = required_status_checks.value.strict
checks = required_status_checks.value.checks
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit-complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ module "repository" {
require_signed_commits = true

required_status_checks = {
strict = true
contexts = ["ci/travis"]
strict = true
checks = ["ci/travis"]
}

required_pull_request_reviews = {
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ variable "branch_protections_v3" {
# require_signed_commits = bool
# required_status_checks = object({
# strict = bool
# contexts = list(string)
# cheecks = list(string)
# })
# required_pull_request_reviews = object({
# dismiss_stale_reviews = bool
Expand All @@ -311,7 +311,7 @@ variable "branch_protections_v3" {
#
# required_status_checks = {
# strict = false
# contexts = ["ci/travis"]
# checks = ["ci/travis"]
# }
#
# required_pull_request_reviews = {
Expand Down

0 comments on commit 78d3197

Please sign in to comment.