Skip to content

push_restrictions does not support mixed types (teams, users, apps) #581

@jcudit

Description

@jcudit

Terraform Version

Terraform v0.12.24

Affected Resource(s)

github_branch_protection

Terraform Configuration Files

resource "github_repository" "test" {
  name      = "tf-acc-test-%s"
  auto_init = true
}

data "github_user" "test" {
  username = "%s"
}

resource "github_team" "test" {
  name = "tf-acc-test-%[1]s"
}

resource "github_branch_protection" "test" {

  repository = github_repository.test.name
  branch     = "main"

  restrictions {
    users = [data.github_user.test.login]
    teams = [github_team.test.slug]
    apps  = []
  }

}

Debug Output

When using actorIDs of mixed type, only the first node is configured. No errors are reported.

{
 "query": "mutation($input:CreateBranchProtectionRuleInput!){createBranchProtectionRule(input: $input){branchProtectionRule{id}}}",
 "variables": {
  "input": {
   "repositoryId": "MDEwOlJlcG9zaXRvcnkzMDg3NTgzODc=",
   "pattern": "main",
   "requiresApprovingReviews": false,
   "requiredApprovingReviewCount": 0,
   "requiresCommitSignatures": false,
   "isAdminEnforced": false,
   "requiresStatusChecks": false,
   "requiresStrictStatusChecks": false,
   "requiresCodeOwnerReviews": false,
   "dismissesStaleReviews": false,
   "restrictsReviewDismissals": false,
   "reviewDismissalActorIds": null,
   "restrictsPushes": true,
   "pushActorIds": [
    "MDQ6VGVhbTQyMjgxNTI=",
    "MDQ6VGVhbTQyMjgxNTM="
   ],
   "requiredStatusCheckContexts": null
  }
 }
}

example request ID: 0400:6BD5:FB26C4:1A4FEA7:5F9C95E0 (two team nodes)
example request ID: 06C0:230F:4CBFE3:7E7B89:5F9C9051 (user node, team node)

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

All actors associated to a branch protection rule.

Actual Behavior

All actors of a single type associated to a branch protection rule.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

References

https://docs.github.com/en/free-pro-team@latest/graphql/reference/input-objects#createbranchprotectionruleinput

A list of User, Team or App IDs allowed to push to matching branches.

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