Skip to content

github_branch_protection is not creating restriction if only a single team is provided. #269

Closed as not planned
@eduardohf-ciandt

Description

@eduardohf-ciandt

Terraform Version

Terraform v0.12.3

  • provider.github v2.2.0

Affected Resource(s)

  • github_branch_protection

Terraform Configuration Files

locals {
    teams = ["admin"]
}

resource "github_repository" "repo" {
  name          = var.name
  description   = var.description
  private       = true
  auto_init     = false
  has_downloads = false
  has_issues    = false
  has_projects  = false
  has_wiki      = false
}

resource "github_branch_protection" "master_branch" {
  repository     = github_repository.repo.name
  branch         = "master"
  enforce_admins = true

  required_pull_request_reviews {
    dismiss_stale_reviews = true
    required_approving_review_count = 1
  }

  restrictions {
    teams = local.teams
  }
}

Expected Behavior

GitHub Branch should show the admin team in "Restrict who can push to matching branches" session.

Actual Behavior

No team is displayed in the "Restrict who can push to matching branches" session.

Steps to Reproduce

  1. terraform plan
  2. terraform apply

Important Factoids

I'm running using remote runners from TFE.

If I run with more than one team the team is properly associate in the "Restrict who can push to matching branches" session".

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