Skip to content

Branch protection not updating #617

@tbalasavage

Description

@tbalasavage

Terraform Version

Terraform v0.13.5
provider registry.terraform.io/hashicorp/github v4.1.0

Affected Resource(s)

Please list the resources as a list, for example:

  • github_branch_protection

Terraform Configuration Files

provider "github" {
  token        = var.github_token
  organization = "MyOrg"
  version      = "~> 4.1.0"
}
...
resource "github_branch_protection" "develop_protection" {
  repository_id  = github_repository.repo.node_id
  pattern        = "develop"
  enforce_admins = true

  required_status_checks {
    strict = true
  }

  required_pull_request_reviews {
    dismiss_stale_reviews = true
  }

  push_restrictions = [data.github_team.1.node_id, data.github_team.2.node_id]
}

Expected Behavior

The branch protection for develop should have been updated to have push restrictions to the teams identified as well as have status checks set.

Actual Behavior

No push restrictions were added and no status checks are required but they were identified to at least have been attempted and were marked as successfully updated.

  # github_branch_protection.develop_protection will be updated in-place
  ~ resource "github_branch_protection" "develop_protection" {
        enforce_admins         = true
        id                     = "id="
        pattern                = "develop"
      ~ push_restrictions      = [
          + "id1=",
          + "id2=",
        ]
        repository_id          = "id="
        require_signed_commits = false

        required_pull_request_reviews {
            dismiss_stale_reviews           = true
            dismissal_restrictions          = []
            require_code_owner_reviews      = false
            required_approving_review_count = 1
        }

      + required_status_checks {
          + strict = true
        }
    }

Steps to Reproduce

  1. terraform apply

Important Factoids

Nothing in particular

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions