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

Dynamically create providers with for each. #25320

Closed
maxcbc opened this issue Jun 20, 2020 · 2 comments
Closed

Dynamically create providers with for each. #25320

maxcbc opened this issue Jun 20, 2020 · 2 comments

Comments

@maxcbc
Copy link

maxcbc commented Jun 20, 2020

Dynamically create providers with for each.

NOTE: I don't think this exist already

Current Terraform Version

0.12.26

Use-cases

We use multiple (20+) AWS accounts in our organisation. I'm currently trying to create various roles for our CI to use, which are all duplicated across different combinations of accounts. for_each for resources enables me to do this easily (thanks for this) by iterating through a list of providers.

Proposal

What I'd really like to do is the following (assume for this that aws_account_name matches the profile in my AWS config, though this could easily work with a role for each account).

locals {
  providers = [
    "aws_account_one",
    "aws_account_two",
    "aws_account_three"
  ]
}

provider "aws" {
  for_each = toset(local.providers)
  alias = each.key
  profile = each.key
  region = "eu-west-1"
}
@jbardin
Copy link
Member

jbardin commented Aug 20, 2020

Closing to track this in #19932

@jbardin jbardin closed this as completed Aug 20, 2020
@ghost
Copy link

ghost commented Oct 11, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants