Skip to content

[BUG]: cannot define multiple instance of the provider #3093

Closed

Description

@fdebuire

Expected Behavior

Be able to define multiple instance of the Github provider using alias

provider "github" {
  owner = "my_org"
  app_auth {}
}

provider "github" {
  owner = "my_org"
  alias = "app"
}

Actual Behavior

❯ terraform plan
╷
│ Error: Conflicting configuration arguments
│
│   with provider["registry.terraform.io/integrations/github"],
│   on terraform.tf line 44, in provider "github":
│   44: provider "github" {
│
│ "app_auth": conflicts with token
╵
╷
│ Error: Conflicting configuration arguments
│
│   with provider["registry.terraform.io/integrations/github"],
│   on terraform.tf line 44, in provider "github":
│   44: provider "github" {
│
│ "token": conflicts with app_auth
╵

Terraform Version

Terraform v1.9.3
on darwin_arm64

  • provider registry.terraform.io/integrations/github v6.10.1

Affected Resource(s)

provider

Terraform Configuration Files

Steps to Reproduce

We were able to use multiple instances of the provider before upgrading to the version 6.10.1 of the provider.

The change has been introduced with those 2 commits:
1268edb

b48779a

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

Activity

  1. added
    Type: Bug
    Status: Triage
    on Jan 19, 2026
  2. github-actions commented on Jan 19, 2026

    @github-actions

    👋 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! 🚀

  3. Jeinhaus commented on Jan 19, 2026

    @Jeinhaus

    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).

  4. deiga commented on Jan 19, 2026

    @deiga
    Collaborator

    @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

  5. fdebuire commented on Jan 19, 2026

    @fdebuire
    Author

    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:

    DefaultFunc: schema.EnvDefaultFunc("GITHUB_TOKEN", nil),

  6. deiga commented on Jan 19, 2026

    @deiga
    Collaborator

    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.

  7. Jeinhaus commented on Jan 19, 2026

    @Jeinhaus

    @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).

  8. stevehipwell commented on Jan 20, 2026

    @stevehipwell
    Collaborator

    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 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.

  9. removed
    Status: Triage
    on Jan 20, 2026
  10. added this to the v6.10.2 Release milestone on Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions