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

Use `json_map_encoded` instead of deprecated to `json_map` in examples #132

Closed nitrocode closed 3 years ago

nitrocode commented 3 years ago

Fix thanks to https://github.com/cloudposse/terraform-aws-ecs-container-definition/pull/131#issuecomment-817907504

nitrocode commented 3 years ago

/test all

DavidGamba commented 3 years ago

When applying this change:

-  container_definitions    = "[${module.container_definition.json_map_encoded},${module.datadog_container_definition.json_map_encoded}]"
+  container_definitions    = jsonencode([module.container_definition.json_map_encoded, module.datadog_container_definition.json_map_encoded])

I get the error:

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

  on ../../modules/fargate_container/main.tf line 130, in resource "aws_ecs_task_definition" "this":
 130:   container_definitions    = jsonencode([module.container_definition.json_map_encoded, module.datadog_container_definition.json_map_encoded])
nitrocode commented 3 years ago

If you apply the example terraform module, do you get the same error?

DavidGamba commented 3 years ago

If you apply the example terraform module, do you get the same error?

I only tried in my own setup running terraform v0.13.6

nitrocode commented 3 years ago

Can you create a new issue with a minimum viable reproducible example ?

davidvasandani commented 3 years ago

@DavidGamba I'm getting the same error. Were you able to find a fix?

DavidGamba commented 3 years ago

I just kept the line as it was before, this only affects the tests and the documentation, if you keep using it the old way you won't have any issues.

container_definitions    = "[${module.container_definition.json_map_encoded},${module.datadog_container_definition.json_map_encoded}]"
mergify[bot] commented 3 years ago

This pull request is now in conflict. Could you fix it @nitrocode? 🙏

korenyoni commented 3 years ago

Equivalent done via https://github.com/cloudposse/terraform-aws-ecs-container-definition/pull/139