Hello, i would like to know if it possibile to something like this:
module “my_module” {
source = “…/…/modules/infrastructure/vpc”
for_each = { for idx, instance in var.instances : idx => instance }
providers = {
aws = each.value.provider
}
cidr_block = each.value.cidr_block
counter = each.value.counter
region = each.value.region
}
i would like to create modules dynamically with different providers, can anyone help me? Thank you
Sadly, i think is not possible…
Because is needed a specific type provider
:
providers = {
aws = each.value.provider
}
provider is declarated once at time like a “singleton” and is not a type like map/list to make reference in for loops.
Ok thank you for your answer. There are no turn around for this or any other type of configuration?
Reading your code, you intent to centralize network between various providers right?
your network is all AWS? if yes, you can create a single account for network creation and share subnets between all accounts of the group using resource sharing.
This is the common way to solve this problem.