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
[BUG]: cannot define multiple instance of the provider #3093
It breaks the feature initially introduced here #1538.
How to reproduce:
Either set two providers, one using a token and the other one using a github app.
Or have the GITHUB_TOKEN env var defined + define the provider to use the github app (which before would by default use the defined provider and the github app, ignoring the env var).
Debug Output
Panic Output
Code of Conduct
I agree to follow this project's Code of Conduct
Reacted by Julian, Luis Dunkum, Vedant Thapa, Cydrick Trudel, Dave and k-saiki
👋 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! 🚀
This also breaks workflows like digger that use GitHub actions and utilize the GITHUB_TOKEN for interaction with the pull request but also configure GitHub providers in Terraform (see diggers example here).
TF_VAR_GITHUB_TOKEN together with var.GITHUB_TOKEN should IMO work.
I'm sorry that the changes I made didn't take into account multiple providers.
We don't currently have tests for multiple providers (we should), so this impact wasn't visible to us.
We are working on overhauling the attributes for the provider to hopefully make configs a lot clearer.
One thing we aim to achieve is to make auth more explicit. So that less magic happens based on what is in the env available.
@deiga I think as a quick fix it would be good to prefer explicit provider configuration if multiple authentication sources exist. E.g. hardcoded credentials are preferred over credentials injected via environment variables. And that the provider doesn't error out if multiple sources are present.
Your suggestion with using TF_VAR_GITHUB_TOKEN is probably good, but doesn't work for the digger workflow I linked in #3093 (comment) where the GITHUB_TOKEN is used but not in the context of the Terraform GitHub provider (in this case for the GitHub action to update the PR).
@deiga we need to remove the defaults from the provider auth fields (token, app_auth.id, app_auth.installation_id & app_auth.pem_file) and calculate them in code. Otherwise the ConflictsWith change breaks configuration. I missed this in review as I forgot that plugin SDK v2 has provider defaults as the plugin framework doesn't support this.
Activity
github-actions commentedon Jan 19, 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! 🚀Jeinhaus commentedon Jan 19, 2026
This also breaks workflows like
diggerthat use GitHub actions and utilize theGITHUB_TOKENfor interaction with the pull request but also configure GitHub providers in Terraform (see diggers example here).deiga commentedon Jan 19, 2026
@fdebuire you would to use some other way than env variables when configuring multiple providers. If env vars are necessary, I'd suggest using TF_VAR
fdebuire commentedon Jan 19, 2026
Hello @deiga, we are using env vars as described in the doc: https://registry.terraform.io/providers/integrations/github/latest/docs#oauth--personal-access-token
I don't think I can use TF_VAR_GITHUB_TOKEN for our use case:
terraform-provider-github/github/provider.go
Line 23 in 8359c39
deiga commentedon Jan 19, 2026
TF_VAR_GITHUB_TOKEN together with var.GITHUB_TOKEN should IMO work.
I'm sorry that the changes I made didn't take into account multiple providers.
We don't currently have tests for multiple providers (we should), so this impact wasn't visible to us.
We are working on overhauling the attributes for the provider to hopefully make configs a lot clearer.
One thing we aim to achieve is to make auth more explicit. So that less magic happens based on what is in the env available.
Jeinhaus commentedon Jan 19, 2026
@deiga I think as a quick fix it would be good to prefer explicit provider configuration if multiple authentication sources exist. E.g. hardcoded credentials are preferred over credentials injected via environment variables. And that the provider doesn't error out if multiple sources are present.
Your suggestion with using TF_VAR_GITHUB_TOKEN is probably good, but doesn't work for the digger workflow I linked in #3093 (comment) where the
GITHUB_TOKENis used but not in the context of the Terraform GitHub provider (in this case for the GitHub action to update the PR).stevehipwell commentedon Jan 20, 2026
See also #3096.
@deiga we need to remove the defaults from the provider auth fields (
token,app_auth.id,app_auth.installation_id&app_auth.pem_file) and calculate them in code. Otherwise theConflictsWithchange breaks configuration. I missed this in review as I forgot that plugin SDK v2 has provider defaults as the plugin framework doesn't support this.