Skip to content

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

Closed

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.

Activity

  1. guillermotti commented on Nov 19, 2020

    @guillermotti

    This is already working with 4.0.1

  2. added
    Type: Bug
    on Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Bugr/branch_protection

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions