Repository navigation
Description
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
- run
terraform planandterraform applywith no pull_request_bypassers - manually add github app to github branch protection gui
terraform planshows [org name]/[app username] to remove- add [org name]/[app username] to terraform pull_request_bypassers
- run
terraform plan- note github app is accepted - run
terraform apply- noteError: 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
Branch protection isn't deprecated (yet) but is referred to as legacy in the docs and UI, have you looked at switching over to using rulesets?
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields🔥 Backlog
- StatusShow more project fieldsBacklog
Activity
carl-knutson commentedon Jun 13, 2024
Also attempted the following with same results:
ivanmartos commentedon Jul 10, 2024
Still valid with provider version
6.2.2msharbaji commentedon Aug 22, 2024
Is there a plan to fix this issue?
tobias-farrenkopf commentedon Sep 17, 2024
As a workaround you can provide the
node-idwhich you can get from the rest api:https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28
rtkwlf-hzzz commentedon Oct 4, 2024
hi @tobias-farrenkopf , we also encountered this issue recently, would you mind providing some details about how to use this workaround ....
we try
but it doesn't work. appreciat it in advance 🙏🙏
Mabog10 commentedon Nov 8, 2024
Hello, below solution works in my case:
github provider version: 6.3.1
jamesgeddes commentedon Nov 13, 2024
Super! If this is intended functionality, then this has just become a request for documentation 😂
Erwan-loot commentedon Dec 24, 2024
Doesn't work at all when your app is private
10 remaining items
Sytten commentedon Dec 8, 2025
Very simple example @stevehipwell: GitHub Rulesets don’t have a "Dismiss stale reviews" option
stevehipwell commentedon Dec 8, 2025
@Sytten I think you might be mistaken.
Sytten commentedon Dec 8, 2025
Ha looks like it @stevehipwell , I swear I did check not that long ago. This was one of blockers we had to switching.
Maybe it was just not supported in the terraform provider?
stevehipwell commentedon Dec 9, 2025
@Sytten if you want I can look back at our history for when we switched over to rulesets as it's one of the foundational constraints we require and we were early adopters? The TF provider implementation hasn't always been perfect, which is partially down to the API, but neither was the branch protection implementation.
deiga commentedon Dec 9, 2025
The only API limitation I currently know of that still requires using
branch_protection: Deployment Environments configured on protected branches only considerbranch_protectionrules and notrepo/org_ruleset.There might of course be TF provider limitations, but we're working on those! It's my personal highest priority, since I want our ClickOps Org Rulesets into Terraform 😬
stevehipwell commentedon Dec 9, 2025
@deiga deployment environments should explicitly call out the refs that can deploy to them, otherwise it's likely that there will be misconfiguration as it's perfectly valid to apply (different) rules to all repo refs. Take for example this repo, until recently there was a branch protection for all refs (
*) so an environment protection using protected would have been useless.deiga commentedon Dec 9, 2025
That is a good point yeah. Especially when managing all of this via TF. We are still part way in ClickOps land, where the protected branches made more sense
stevehipwell commentedon Dec 9, 2025
We originally had protected branches but as soon as it was viable (actually before as we used a lifecycle ignore to stop the provider erroring) we switched over to rulesets as we could configure these across a whole organization.
jazanne commentedon Aug 21, 2026
any updates?
deiga commentedon Aug 21, 2026
@jazanne This would be the most relevant update: #2236 (comment)
tkosushi commentedon Nov 13, 2026
Additional reproduction details for the private-App case on integrations/github v6.13.0, Terraform v1.16.4 (linux_amd64, remote execution).
The
data.github_app.<name>.node_idworkaround does not resolve the failure in our setup. Unlike the original report's empty ID, our error contains the exact, non-empty node ID returned by the REST API.Setup and Terraform behavior
app_authas GitHub App A, with an installation in the organization.data.github_appsuccessfully reads App B. The plan adds itsnode_idtorequired_pull_request_reviews.pull_request_bypassers.github_branch_protectionfails withCould not resolve to a node with the global id of '<APP_B_NODE_ID>'.Relevant configuration, reduced and anonymized from the failing configuration (not a separately tested standalone fixture):
API-level isolation, without Terraform
Using an installation token minted for App A, with no additional repository or permission narrowing:
GET /apps/<APP_B_SLUG>succeeds and returns App B's numericid,node_id, andslug.node_idfails:{ "data": { "node": null }, "errors": [{ "type": "NOT_FOUND", "path": ["node"], "message": "Could not resolve to a node with the global id of '<APP_B_NODE_ID>'." }] }ghauthentication, returning__typename: "App"and the same node ID and slug.The REST and GraphQL checks used separately minted tokens for the same App A installation; neither token requested reduced permissions or repository scope. No credentials or actual organization/App identifiers are included here.
This isolates an authentication-dependent REST/GraphQL visibility difference, rather than an empty or incorrect node ID. It does not establish whether the cause is a GitHub API limitation/bug or something the provider can address. We have not tested changing App B to public, a REST-based branch-protection update, or a ruleset migration.
Is this a known upstream restriction when one installation token resolves another private App through GraphQL? If so, could the provider document the limitation/workaround, or is there an upstream GitHub issue/support route we should use for this reproduction?