Skip to content

v3.1.0 github_branch_protection does not apply required_status_checks when set to false #572

@wilmer-mendez-globant

Description

@wilmer-mendez-globant

Terraform Version

v0.13.3

Affected Resource(s)

Please list the resources as a list, for example:

  • github_branch_protection

Terraform Configuration Files

locals {
  repo_settings    = jsondecode(file(var.filename))
  branches_created = toset(local.repo_settings.additional_branches)
  repo_perms       = merge(var.org_perms, local.repo_settings.teams)
}

resource "github_branch_protection" "set_rules" {
  for_each = local.repo_settings.branch_protection

  repository_id          = github_repository.create_repo.node_id
  pattern                = each.key
  enforce_admins         = each.value.enforce_admins
  require_signed_commits = each.value.require_signed_commits

  required_pull_request_reviews {
    required_approving_review_count = each.value.required_pull_request_reviews.required_approving_review_count
    dismiss_stale_reviews           = each.value.required_pull_request_reviews.dismiss_stale_reviews
    require_code_owner_reviews      = each.value.required_pull_request_reviews.require_code_owner_reviews
  }

  required_status_checks {
    strict   = "false"
  }
}

Expected Behavior

Terraform should have updated the statefile with the required_status_checks attribute set to false.

Actual Behavior

Terraform does not update the statefile so tf plan or tf apply show required_status_checks add on each run.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions