Hello Terraform community,
I am currently working on our AWS account setup using Terraform.
What I want to achieve:
I already have a module that creates a secret. I would like to create a Secrets Manager secret in multiple accounts based on a variable list the module receives.
It is important that the module creating the secret is easy to use. Outputting and creating single resources with static providers is not really an option for our users.
Problem:
For every account, I need a statically defined provider which I cannot create dynamically.
I know this is a well-known problem, and I have already read these references:
- Is anyone aware of how to instantiate dynamic providers - #4 by irab
- Ability to pass providers to modules in for_each · Issue #24476 · hashicorp/terraform · GitHub
- Dynamic provider configuration assignment · Issue #25244 · hashicorp/terraform · GitHub
- Is provider variable possible in terraform? - Stack Overflow
Are there any good workarounds anybody is using that I might not have thought of?
Currently, I am considering using Secrets replication, which will cause additional costs and complexity (custom KMS key + sync which is not required).
Thanks for any input on this!