You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After having an amazing time Googling the absence of dynamic providers and coming through Github issues such as #19932
I was forced to try a magic work around that looked like this -
resource "aws_config_configuration_recorder" "config_recorder" {
for_each = toset([ for key, value in var.enabled_regions : "aws.${value}"])
provider = each.value
name = "config_recorder"
role_arn = var.config_recorder_role_arn
recording_group {
all_supported = true
include_global_resource_types = true
}
}
However this does not work because Terraform reads the each.value as a literal provider. So I would've thought adding in "${each.value}"' would work but this also does not allow strings. When I tried to add a provider such as "aws.eu-west-2"` it gives me the below warning -
Warning: Quoted references are deprecated
│
│ on ../main.tf line 3, in resource "aws_config_configuration_recorder" "config_recorder":
│ 3: provider = "aws.eu-west-2"
│
│ In this context, references are expected literally rather than in quotes. Terraform 0.11 and earlier required quotes, but quoted references are
│ now deprecated and will be removed in a future version of Terraform. Remove the quotes surrounding this reference to silence this warning.
Are we able to change this to allow for strings to be passed through?
For my use case is that we need to deploy AWS Config into every single region and unfortunately AWS does not provide anything here to handle this - so I turn to Terraform for assistance and this is also now letting me down unfortunately! If we could rectify this then surely this could be a quick work around for some more clear Terraform code in the "Dynamic Provider" issue
I welcome any assistance thank you!
The text was updated successfully, but these errors were encountered:
Providers currently need to be statically defined so that they can be resolved when decoding the configuration. We are tracking the possibility of allowing more dynamic assignments in the feature request here: #25244
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
After having an amazing time Googling the absence of dynamic providers and coming through Github issues such as #19932
I was forced to try a magic work around that looked like this -
However this does not work because Terraform reads the
each.value
as a literal provider. So I would've thought adding in"${each.value}"' would work but this also does not allow strings. When I tried to add a provider such as
"aws.eu-west-2"` it gives me the below warning -Are we able to change this to allow for strings to be passed through?
For my use case is that we need to deploy AWS Config into every single region and unfortunately AWS does not provide anything here to handle this - so I turn to Terraform for assistance and this is also now letting me down unfortunately! If we could rectify this then surely this could be a quick work around for some more clear Terraform code in the "Dynamic Provider" issue
I welcome any assistance thank you!
The text was updated successfully, but these errors were encountered: