Hi,
I’m wondering if the ‘providers’ parameter in a module can be read/counted/looped through?
example.tf
module "example" {
source = ../module/example
name = "example_name
providers = {
aws = aws
aws.useast1 = aws.useast1
}
}
module/example/providers.tf
provider "aws" {
for_each = provider(s).key
alias = each.value
}
The error it gives is; A managed resource “provider(s)” “key” has not been declared in module “example”. *() Wasnt sure if its provider or providers so tried both and got the same error
I can hardcode these values as there only two for the provider, but what if something needs to be deployed in both regions?
module/example/main.tf
resource "aws_s3_bucket" "bucket" {
for_each = provider(s).key
provider = each.value
}