Terraform v0.12.3
+ provider.aws v2.18.0
+ provider.local v1.3.0
variable "config" {
type = object({
container_secrets = list(string)
custom_container_secrets = list(object({ # ECS secrets map
name = string
valueFrom = string
}))
})
}
variable "environment" {}
locals {
secrets = [
# Generate ECS secrets map
for secret in var.config["container_secrets"] :
{
name = secret
valueFrom = join("/", ["/services", local.service_name, var.environment, secret])
}
]
service_name = "xyz"
}
resource "local_file" "foo" {
content = jsonencode(var.config["custom_container_secrets"] == null ? local.secrets : concat(local.secrets, var.config["custom_container_secrets"]))
filename = "${path.module}/foo.bar"
}
foo.bar file to be created with content []
Empty foo.bar file is created.
Hi @vermdeep,
This looks similar to, and should also be fixed by #21957.
It is turning up in a slightly different place however, so I'll leave this open until we can confirm.
This appears to be working as expected in 0.12.4.
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.