cloudposse / terraform-aws-ecs-container-definition

Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
https://cloudposse.com/accelerate
Apache License 2.0
340 stars 245 forks source link

json: cannot unmarshal object into Go value of type []*ecs.ContainerDefinition #100

Closed michal-adamkiewicz closed 3 years ago

michal-adamkiewicz commented 4 years ago

Hey guys,

I guess it's definitely something on my end, but recently I have changed from version 0.23 to latest one (to support TF 0.13). Based on that unfortunately all my projects starts throwing errors like in title.

Before I had:

resource "aws_ecs_task_definition" "task_definition"
{
...
  container_definitions    = module.my_own_name.json
}

Now I changed output name accordingly to your documenation like below:

resource "aws_ecs_task_definition" "task_definition"
{
...
  container_definitions    = module.my_own_name.json_map_encoded
}

But that gives me:

ECS Task Definition container_definitions is invalid: Error decoding JSON: json: cannot unmarshal object into Go value of type []*ecs.ContainerDefinition

Really I would be gratefully for any help

flyinprogrammer commented 3 years ago

container_definitions

is expecting a string, and to be a list, so if you're providing a single definition, you likely want to use:

module.my_own_name.json_map_encoded_list
michal-adamkiewicz commented 3 years ago

Thanks a lot!