Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Multiple configurations present' error when overriding provider roles #11079

Closed
wandergeek opened this issue Dec 1, 2019 · 2 comments
Closed
Labels
stale Old or inactive issues managed by automation, if no further action taken these will get closed. waiting-response Maintainers are waiting on response from community or contributor.

Comments

@wandergeek
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.14

Affected Resource(s)

provider "aws"

Terraform Configuration Files

settings.tf

terraform {
  required_version = "0.11.14"

  backend "s3" {
    role_arn             = "arn:aws:iam::xxxxx:role/cross_account/sre"
    workspace_key_prefix = "xxxxxx"
    bucket               = "xxxxxx"
    key                  = "xxxxxx.tfstate"
    encrypt              = "true"
    region               = "ap-northeast-1"
  }
}

provider "aws" {
  region  = "ap-northeast-1"
  version = "2.15.0"

  assume_role {
    session_name = "terraform"
    role_arn     = "arn:aws:iam::xxxxxx:role/cross_account/sre"
  }
}

provider "aws" {
  region  = "ap-southeast-1"
  version = "2.15.0"
  alias   = "ap-southeast-1"

  assume_role {
    session_name = "terraform"
    role_arn     = "arn:aws:iam::xxxxxx:role/cross_account/sre"
  }
}

override.tf

terraform {
  required_version = "0.11.14"

  backend "s3" {
    role_arn             = "arn:aws:iam::xxxxx:role/services/terraform_ops"
    workspace_key_prefix = "xxxxxx"
    bucket               = "xxxxxx"
    key                  = "xxxxxx.tfstate"
    encrypt              = "true"
    region               = "ap-northeast-1"
  }
}

provider "aws" {
  region  = "ap-northeast-1"
  version = "2.15.0"

  assume_role {
    session_name = "terraform"
    role_arn     = "arn:aws:iam::xxxxxx:role/services/terraform_ops"
  }
}

provider "aws" {
  region  = "ap-southeast-1"
  version = "2.15.0"
  alias   = "ap-southeast-1"

  assume_role {
    session_name = "terraform"
    role_arn     = "arn:aws:iam::xxxxxx:role/services/terraform_ops"
  }
}

The only difference between settings.tf and the override file is the roles have been switched from arn:aws:iam::xxxxxx:role/cross_account/sre to arn:aws:iam::xxxxxx:role/services/terraform_ops.

Debug Output

Full output: https://gist.github.com/wandergeek/09ee3117c12cc47e5a5efef038e026dd

Expected Behavior

I should be able to override the role_arn for aws provider aliases.

Actual Behavior

Error message

Error: provider.aws.ap-southeast-1: multiple configurations present; only one configuration is allowed per provider

Steps to Reproduce

  1. Create settings.tf and override.tf with the contents above.
  2. Run make init

Important Factoids

  • For 2HA regions, we create these aliases in order to provide 3HA for our platform.
  • We have to swap these roles during CI runs for operational and security purposes
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 1, 2019
@justinretzolk
Copy link
Member

Hey @wandergeek 👋 Thank you for taking the time to file this issue. Given that there's been a number of Terraform and AWS provider releases since you initially filed it, can you confirm whether you're still experiencing this behavior?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 18, 2021
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Nov 24, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Old or inactive issues managed by automation, if no further action taken these will get closed. waiting-response Maintainers are waiting on response from community or contributor.
Projects
None yet
Development

No branches or pull requests

2 participants