Hi,
I have the following map object variable that I want to set as env variable in the ecs container.
In terraform console, I was able to successfully jsonencode and jsondecode this object and can’t figure out why it’s not being correctly decoded for use in the container definition. A terraform plan with just the default value of that variable fails with the JSON decode error in the title. I’m using AwS provider v4.67.0.
Any help in getting this working is much appreciated!
variable "data_filters_map" {
description = "Map of data filters"
default = {
filter_type_one = {
dataset = "example_dataset_one"
version = "v1.0.0"
}
filter_type_two = {
dataset = "example_dataset_two"
version = "v2.1.0"
}
filter_type_three = {
dataset = "example_dataset_three"
version = "v3.5"
}
}
}
This is passed to the container definition template:
filters_config = jsonencode(var.data_filters_map)
And used in the template:
{
"name": "FILTERS_CONFIG",
"value": "${filters_config}"
}