terraform-aws-ecs-fargate-task-definition
terraform-aws-ecs-fargate-task-definition copied to clipboard
Container Memory/CPU Settings are also used for task CPU/Memory - breaking multiple containers
The current version 1.0.36 uses the input container_cpu and container_memory both for the primary Container Definition (which is required to be configured) as well as the ECS Task definition. This creates a problem with adding more containers using additional_containers
. You cannot specify cpu / memory settings for those additional containers, or the sum of all cpu / all memory will always be greater than the task cpu / memory.
Thus when launching tasks configured this way, the additional container can only have 0 memory / 0 cpu. This is a simple fix, in which we can add task_memory
and task_cpu
variables to the module, and ensure that these are used for the container. As long as the primary container definition and any additional containers have a sum of cpu / memory that is less than the total, both containers will be able to start.
This also means that the multiple_containers example provided with this version does NOT work as advertised.