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

[BUG]: unable to add github apps to bypassers #2236

Open
1 task done
jamesgeddes opened this issue Apr 21, 2024 · 0 comments
Open
1 task done

[BUG]: unable to add github apps to bypassers #2236

jamesgeddes opened this issue Apr 21, 2024 · 0 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@jamesgeddes
Copy link

jamesgeddes commented Apr 21, 2024

Expected Behavior

should be able to add a github app (bot) to PR bypassers, as indicated by the docs;

pull_request_bypassers: (Optional) The list of actor Names/IDs that are allowed to bypass pull request requirements. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams.

Can add a GitHub app using the GUI, but not in Terraform. When a GitHub app is manually added to the PR bypassers in the GUI, it shows up in terraform as [org name]/[app username].

NB This was tested within a GitHub org using a github app that had been granted all permissions.

Actual Behavior

terraform apply returned the following error.

github_branch_protection.trunk_protection["test-trunk-protection"]: Modifying... [id=***]
github_branch_protection.trunk_protection["test-trunk-protection"]: Still modifying... [id=***, 10s elapsed]
github_branch_protection.trunk_protection["test-trunk-protection2"]: Still modifying... [id=***, 10s elapsed]

Error: Could not resolve to a node with the global id of ''

  with github_branch_protection.trunk_protection["test-trunk-protection2"],
  on github.tf line 38, in resource "github_branch_protection" "trunk_protection":
  38: resource "github_branch_protection" "trunk_protection" {


Error: Could not resolve to a node with the global id of ''

  with github_branch_protection.trunk_protection["test-trunk-protection"],
  on github.tf line 38, in resource "github_branch_protection" "trunk_protection":
  38: resource "github_branch_protection" "trunk_protection" {

fails when specifying github app as,

  • [org name]/[app login] (the format returned by a terraform plan!)
  • /[org name]/[app login]
  • [app user id]
  • /[app user login]
  • /[app user login][bot]
  • [app installation id]

Terraform Version

Terraform v1.8.0
GitHub provider v6.2.1

Affected Resource(s)

github_branch_protection

Terraform Configuration Files

resource "github_branch_protection" "trunk_protection" {
  pattern                         = "main"
  repository_id                   = "test-trunk-protection"
...
  required_pull_request_reviews {
    pull_request_bypassers = compact(concat(
      ["/jamesgeddes"],         # This human user works as expected.
    ))
  }
}

resource "github_branch_protection" "trunk_protection2" {
  pattern                         = "main"
  repository_id                   = "test-trunk-protection2"
...
  required_pull_request_reviews {
    pull_request_bypassers = compact(concat(
      ["/jamesgeddes"],         # This human user works as expected.
      ["geddesfamily/gedbot"],  # As soon as this GitHub app is added, Terraform returns the aforementioned error.
    ))
  }
}

Steps to Reproduce

  1. run terraform plan and terraform apply with no pull_request_bypassers
  2. manually add github app to github branch protection gui
  3. terraform plan shows [org name]/[app username] to remove
  4. add [org name]/[app username] to terraform pull_request_bypassers
  5. run terraform plan - note github app is accepted
  6. runterraform apply - note Error: Could not resolve to a node with the global id of '' error

Debug Output

No response

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jamesgeddes jamesgeddes added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Apr 21, 2024
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants