Skip to content

multiple-containers example does not work #64

@joverman-collective

Description

@joverman-collective

The multiple-containers example doesn't work after adding the additional_containers variable since it's used as such:

resource "aws_ecs_task_definition" "td" {
  container_definitions = jsonencode(concat(var.additional_containers, [module.container_definition.json_map_object]))
  ...

Only specifying additional_containers and not specifying the container directly makes us concat the additional_containers with essentially {}, which isn't a valid task definition. This gives the error:

Error: creating ECS Task Definition (my-td): operation error ECS: RegisterTaskDefinition, https response error StatusCode: 400, RequestID: 607d430b-b0ca-49c1-9ae3-c1f30ba8320d, ClientException: Container.name should not be null or empty.
│ 
│   with module.app.module.backend-service.module.ecs-fargate-task-definition["migration"].aws_ecs_task_definition.td,
│   on .terraform/modules/app.backend-service.ecs-fargate-task-definition/main.tf line 85, in resource "aws_ecs_task_definition" "td":
│   85: resource "aws_ecs_task_definition" "td" {

This should check to see if module.container_definition.json_map_object is "empty" before adding it to the container_definitions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions