You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
misleading diff (false -> true) for merge settings when authenticated with restricted GitHub App token #3382
When using the integrations/github provider with a GitHub App token that has Administration: Read but lacks Contents: Write (push access), terraform plan shows a perpetual diff for repository merge settings even if they are already correctly configured on GitHub.
Current Behavior
The GitHub API omits merge settings (like allow_merge_commit, allow_squash_merge, etc.) from the repository response if the authenticated user lacks push access. The Terraform provider currently interprets these missing fields as false (or empty strings), leading to a diff where Terraform attempts to change them from false -> true (or similar) on every plan.
Expected Behavior
If these fields are missing from the API response due to permission restrictions, the provider should throw an error if all required information cannot be fetched from the api, explainind which permissions are needed.
Impact
Users wanting to perform "Read-only" plans or audits using restricted GitHub App tokens (following the principle of least privilege) are forced to either:
Grant Contents: Write (push access) just to get a clean plan.
Use lifecycle { ignore_changes = [...] }, which prevents Terraform from managing these settings even when using a high-privilege token.
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀
What is the behaviour you would like to see? Without correct permissions Terraform can't know the correct diff to show.
Should it throw an error instead? I don't know if it's possible to check missing permissions 🤔
Error would be the correct behaviour imho. Can missing properties be detected by simply looking at the payload, or are these optional a d could be missing even if requester has all permissions?
I think that building a heuristic to determine from the payload if permissions are missing could be quite brittle and hard to maintain.
But I seem to recall that some API call returns scopes in a Header 🤔
If that's reasonable to use and ubiquitous enough, that could work in many other places as well.
But throwing an error might still be an unexpected outcome, maybe we can return a warning for those fields...
I'd say there is a valid use-case for seeing a plan with lacking permissions.
And I guess applying should be possible as well without those permissions since the rest is applyable
I'd say there is a valid use-case for seeing a plan with lacking permissions. And I guess applying should be possible as well without those permissions since the rest is applyable
But isn't the plan a bit useless given it shows a fictional diff based on defaults put in place missing properties? I guess the only case where it's not misleading is when the tf config doesn't include any of the properties which are not accessible due to missing permissions. Seems like there really should be (a) sperate resource(s) for the part(s) which require additional permissions.
IMHO the provider is working as intended, the GitHub API shapes the response based on the auth scope and it's up to the user to make sure they have granted the privider the correct permissions. The provider can't ignore changes due to missing content from the response automatically, if you want this pattern you need to explicitly set ignores on the resource.
If you're asking for the provider to gate resources based on permissions, we'd need a way to handle this in the plan phase; which would require full permissions at all times. I think this is what you're trying to avoid?
Linking #3741 from @karlkeefer here for reference. We closed it as part of our temporary move to an issue-first model (see CONTRIBUTING.md), and want to keep the context and implementation approach handy when we pick this issue up.
Thanks @robert-crandall - happy to weigh in on any issues, or run tf plan against a proposed patch with my read-only tokens if/when this comes up later 🙌
We only use GraphQL if we absolutely have to (and we're removing it wherever possible), this case doesn't meet that criteria as there is a fully functional REST API endpoint. The current provider behaviour is working as expected, you need to provide the right permissions for the resource to function correctly (or use a lifecycle block to ignore them). If you'd like to talk directly with GitHub to get parity between the REST and GraphQL API that'd be great, but that's not a provider issue.
@robert-crandall I think this issue should be closed as wont fix.
The current provider behaviour is working as expected
that depends on the definition of "expected". As far as I'm concern current behaviour makes for really shitty DX
the fact that it's blocked by something you can't directly change doesn't make the issue disappear, I am happy to escalate this further but IMHO, the issue should remain open until it's actually fixed
If you'd like to talk directly with GitHub to get parity between the REST and GraphQL API that'd be great, but that's not a provider issue
Not really, it's more an issue of context. With the full context, this behaviour is expected as it's the way the system has been built and consistently observed.
As far as I'm concern current behaviour makes for really shitty DX
You wont get an argument against this position from me.
the fact that it's blocked by something you can't directly change doesn't make the issue disappear, I am happy to escalate this further but IMHO, the issue should remain open until it's actually fixed
It doesn't make it disappear, but it makes it part of the provider API surface.
Where should I submit the issue? thanks!
If you can figure this out please let me know. If you're an enterprise customer I'd suggest starting with your account team.
Activity
github-actions commentedon Apr 30, 2026
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with
Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀deiga commentedon May 10, 2026
This is already documented in the provider docs.
What is the behaviour you would like to see? Without correct permissions Terraform can't know the correct diff to show.
Should it throw an error instead? I don't know if it's possible to check missing permissions 🤔
adrian-gierakowski commentedon May 10, 2026
Error would be the correct behaviour imho. Can missing properties be detected by simply looking at the payload, or are these optional a d could be missing even if requester has all permissions?
deiga commentedon May 10, 2026
I think that building a heuristic to determine from the payload if permissions are missing could be quite brittle and hard to maintain.
But I seem to recall that some API call returns scopes in a Header 🤔
If that's reasonable to use and ubiquitous enough, that could work in many other places as well.
But throwing an error might still be an unexpected outcome, maybe we can return a warning for those fields...
adrian-gierakowski commentedon May 10, 2026
Is there a valid use case for applying such resources with incomplete permissions?
deiga commentedon May 10, 2026
I'd say there is a valid use-case for seeing a plan with lacking permissions.
And I guess applying should be possible as well without those permissions since the rest is applyable
adrian-gierakowski commentedon May 10, 2026
But isn't the plan a bit useless given it shows a fictional diff based on defaults put in place missing properties? I guess the only case where it's not misleading is when the tf config doesn't include any of the properties which are not accessible due to missing permissions. Seems like there really should be (a) sperate resource(s) for the part(s) which require additional permissions.
stevehipwell commentedon May 26, 2026
IMHO the provider is working as intended, the GitHub API shapes the response based on the auth scope and it's up to the user to make sure they have granted the privider the correct permissions. The provider can't ignore changes due to missing content from the response automatically, if you want this pattern you need to explicitly set ignores on the resource.
If you're asking for the provider to gate resources based on permissions, we'd need a way to handle this in the plan phase; which would require full permissions at all times. I think this is what you're trying to avoid?
fix: preserve repository fields the API omits
fix: preserve repository fields a read-only token cannot see
fix: preserve repository fields a read-only token cannot see
Hixie commentedon Oct 28, 2026
FWIW, it seems you can get this information with a read-only token via the GraphQL API.
karlkeefer commentedon Nov 20, 2026
@Hixie suggestion works for our tf drift check in CI (🙇♂️), which doesn't have
contents: write- see #3741robert-crandall commentedon Nov 25, 2026
Linking #3741 from @karlkeefer here for reference. We closed it as part of our temporary move to an issue-first model (see CONTRIBUTING.md), and want to keep the context and implementation approach handy when we pick this issue up.
karlkeefer commentedon Nov 25, 2026
Thanks @robert-crandall - happy to weigh in on any issues, or run
tf planagainst a proposed patch with my read-only tokens if/when this comes up later 🙌stevehipwell commentedon Nov 27, 2026
We only use GraphQL if we absolutely have to (and we're removing it wherever possible), this case doesn't meet that criteria as there is a fully functional REST API endpoint. The current provider behaviour is working as expected, you need to provide the right permissions for the resource to function correctly (or use a lifecycle block to ignore them). If you'd like to talk directly with GitHub to get parity between the REST and GraphQL API that'd be great, but that's not a provider issue.
@robert-crandall I think this issue should be closed as wont fix.
adrian-gierakowski commentedon Nov 29, 2026
that depends on the definition of "expected". As far as I'm concern current behaviour makes for really shitty DX
the fact that it's blocked by something you can't directly change doesn't make the issue disappear, I am happy to escalate this further but IMHO, the issue should remain open until it's actually fixed
Where should I submit the issue? thanks!
stevehipwell commentedon Nov 30, 2026
Not really, it's more an issue of context. With the full context, this behaviour is expected as it's the way the system has been built and consistently observed.
You wont get an argument against this position from me.
It doesn't make it disappear, but it makes it part of the provider API surface.
If you can figure this out please let me know. If you're an enterprise customer I'd suggest starting with your account team.