Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jcudit opened this issue Nov 1, 2020 · 2 comments · Fixed by #615
Closed

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

jcudit opened this issue Nov 1, 2020 · 2 comments · Fixed by #615
Labels
r/branch_protection Type: Bug Something isn't working as documented

Comments

@jcudit
Copy link
Contributor

jcudit commented Nov 1, 2020

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.

@guillermotti
Copy link

This is already working with 4.0.1

@patrickmarabeas
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r/branch_protection Type: Bug Something isn't working as documented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants