Re:Terraform best practices for reliability at any scale
by 333throwaway342 on Friday August 04, 2023 @10:54PM
(#37008516)
providers do not support `for_each` or `count`
Re:Terraform best practices for reliability at any scale
by linuxdude314 on Saturday August 05, 2023 @01:38PM
(#37014500)
Let's say you need to configure a provider for 3 different regions. The natural way you want to do this is store the regions in a variable, and iterate over the variable using "for_each".
What you are referring to are called "provider aliases" and they work well for _avoiding_ using terragrunt (not very DRY though).
I assume you're aware you can instantiate multiple versions (different params) of a provider and pass them to child modules, e.g. you can instantiate a module once for each of a several AWS regions/accounts?
Do you mean that something like the region/account param would be set on the basis of a computed value from some other resource (because we created the account, say, or listed all regions satisfying some filter with a data source)?