Repository navigation
Description
Terraform Version
Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.
0.13.5
Affected Resource(s)
All github resources that require authentication.
Terraform Configuration Files
provider "github" {
owner = "MyOrg"
app_auth {
# correct values are set on the command line
}
}Debug Output
Mon, 15 Nov 2021 00:50:18 GMT
/home/runner/work/_temp/82078d0e-8462-4088-a73b-519aff5c7a56/terraform-bin refresh --parallelism 50
Mon, 15 Nov 2021 00:50:46 GMT
module.my_module.data.github_team.core: Refreshing state... [id=...34]
[...many successful objects being refreshed...]
Mon, 15 Nov 2021 01:50:48 GMT
aws_iam_user_policy.tf_user: Refreshing state... [id=my-repo:state-access]
Mon, 15 Nov 2021 01:50:48 GMT
Error: GET https://api.github.com/repos/MyOrg/my-repo: 403 API rate limit of 60 still exceeded until 2021-11-15 02:50:44 +0000 UTC, not making remote request. [rate reset in 59m57s]
Panic Output
None
Expected Behavior
Authentication should be valid for as long as it takes terraform to run.
Actual Behavior
Credentials time out after an hour. Installation Access Tokens are valid for exactly one hour:
Installation access tokens have the permissions configured by the GitHub App and expire after one hour.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform refresh
Important Factoids
We have a very large set of repositories managed by the github provider. In attempting to switch from OAuth token authentication to GH Apps authentication, we have discovered that after approximately an hour (+ a few seconds usually) we start getting 403s to resources that are expressily allowed by our GH App permissions.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity
github-actions commentedon Nov 30, 2022
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!kfcampbell commentedon Dec 1, 2022
Pinning this issue as I believe it's still important and relevant.
x-yuri commentedon Jun 20, 2023
@jcogilvie The link you provided doesn't have that phrase. It was probably moved here. But it looks like they're talking about access tokens which supposedly have nothing to do with it. If I understand you correctly, for an hour
terraforminvocations succeed, after an hour they stop succeeding. Also the debug output ends with a rate limit error message. Which supposedly means that the issue is not with expiration.On the other hand I do seem to experience expiration issues. Here's a brief explanation of how I gave
terraformaccess to GitHub. That is, it's about making API request, but in case ofterraformyou probably don't need to obtain an access token. And you certainly don't need to make API requests. But AFAICS you need to activate a device at https://github.com/login/device Whatever that means. And I guess that's the thing that expires in my case. I'm not exactly sure, but I'm going to confirm it in the near future.Which brings up the question, did you not need to activate a device to make it work in the first place?
jcogilvie commentedon Jun 20, 2023
My issue is specific to logging in as an app installation with the GitHub App
app_authfield of the provider, given an app ID, an app installation ID, and a PEM file.I can't speak to the internal workings of the provider, but it's more than likely that it exchanges those credentials for a token that's valid for an hour.
22 remaining items
feat: support automatic GitHub App token refresh for app_auth (integr…
feat: support automatic GitHub App token refresh for app_auth (integr…
benjaminlukeclark commentedon Dec 17, 2025
Commenting on here.
If you're using terraform to manage GitHub at an enterprise scale you do run into this quite frequently.
deiga commentedon Apr 19, 2026
For a workaround: actions/create-github-app-token#121 (comment)
yashrajdighe commentedon Jun 15, 2026
Raised a PR to fix this issue: #3489
deiga commentedon Jul 22, 2026
Resolved with the new client implementation. Use it with
legacy_client = false