Open JakeNeyer opened 5 years ago
I've also encountered this limition trying to achieve multi-region deploys for my app, I've ended up using TF templates with Terragrunt to generate Terraform code simulating the desired for_each behavior. It's ugly and doesn't provide any IDE niceness a normal .tf file would, but it works
Please fix... I meant please implement
I don't understand why the industry has chosen to adopt a tool with a broken for loop. And when you try to explain why you're wrapping Terraform in jinja2, engineers get mad. I'd just as soon use Ansible... or a shell script.
Take a look at OpenTofu, I believe they're adding support for this in the upcoming release.
@aleksasiriski can you provide some link to opentofu docs about that ?
@mcandre terramate is a great workaround for this limitation instead of jinja2
@aleksasiriski can you provide some link to opentofu docs about that ?
Probably this one - https://github.com/opentofu/opentofu/issues/300, and they also have a backlink to this issue, right after this comment.
It seems Hashicorp decided to implement this feature as part of stacks: https://developer.hashicorp.com/terraform/language/stacks/use-cases#deploy-across-regions
... which currently is only available on their HCP Terraform service, with no guarantee this feature will come to the Community edition.
In other news, OpenTofu is officially going to support this natively: https://github.com/opentofu/opentofu/releases/tag/v1.9.0-alpha1
Current Terraform Version
Use-cases
In my current situation, I am using the AWS provider so I will scope this feature request to that specific provider, although this may extend to other providers as well.
I am attempting to create resources in multiple AWS accounts. The number of the accounts ranges from 0....x and will be dynamic. I would like to be able to instantiate multiple providers which can assume a role in each account, and in turn, create resources with the associated provider without hard-coding providers for each subsequent account.
For example, something like this: