Open tmccombs opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
I am looking into Guardduty and need to generate 23 providers, one for each supported region to enable Guardduty, it would be much simpler to just have a for_each
over the regions. Unfortunately Terraform does not allow dynamic providers...
There is also a problem with having the region on provider level, if you create resources in the wrong region and then change the region on the provider, Terraform only wants to create the resource in the new region, but doesn't want to destroy the resource in the wrong region.
If I were to create pull requests to add support for this for at least some resources, would that be likely to be accepted? (contingent on it being high enough quality of course)
Hi @tmccombs π We have been chatting with @brittandeyoung about this (he has put a compelling PoC together in #31517) and we are all positive about the approach. There is some internal due diligence we need to get through in introducing what is a bit of a paradigm change in how the provider is used. We have that scheduled for next quarter after which we will update to community on how we propose to implement and introduce it to the provider, would love feedback at that point.
Appreciate your patience and input!
It's two quarters later, @breathingdust ; is there an update? I don't see one here or on #31517 . Thanks!
Is there any progress on this? The friction it causes in multi-region deployments is very high. EDIT: typo
@take-five π The maintainers are actively working on an RFC to enable this functionality. Expect more information in the next couple of months.
Description
When working with multiple regions, currently in most cases you have to use a separate aws provider alias for each region. While this is workable in many cases, there are other cases where it is not very workable. In the best case it means you have to duplicate your provider configuration, varying only in the region. In other cases it can seriously constrain the design of the terraform code. If resources allowed you to specify the region to use for them, through an attribute that override the default region of the provider, than it would simplify working with multiple regions without having to wait for support for more dynamic provider configuration from the terraform engine.
Example Use Cases
Here are some specific use cases where being able to create resources in multiple regions with the same provider would be beneficial:
Affected Resource(s) and/or Data Source(s)
Many. Some of the most important ones are possibly:
Potential Terraform Configuration
The example from https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_replica_key
could be rewritten to something like:
Or if used in a module that accepts multiple regions something like:
References
Some more specific issues:
Would you like to implement a fix?
No response