From fd6e442df671d46620bea4c192da808b39123017 Mon Sep 17 00:00:00 2001 From: Benjamin Chodoroff Date: Mon, 22 Jun 2020 12:56:49 -0400 Subject: [PATCH 1/2] set cpu and memory at task level, for fargate compatibility --- main.tf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.tf b/main.tf index 3cc8475..e5fe62d 100644 --- a/main.tf +++ b/main.tf @@ -135,6 +135,11 @@ resource "aws_ecs_task_definition" "ecs_task_definition" { ipc_mode = var.ipc_mode network_mode = var.network_mode pid_mode = var.pid_mode + + # Fargate requires cpu and memory to be defined at the task level + cpu = var.cpu == 0 ? "null" : var.cpu + memory = var.memory == 0 ? "null" : var.memory + dynamic "placement_constraints" { for_each = var.placement_constraints content { From ac766ae2bf82454a8361d3be180cb8098089c857 Mon Sep 17 00:00:00 2001 From: Benjamin Chodoroff Date: Mon, 22 Jun 2020 13:20:46 -0400 Subject: [PATCH 2/2] set fargate-incompatible variables to null by default --- variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variables.tf b/variables.tf index 4c538f7..f2b18fd 100644 --- a/variables.tf +++ b/variables.tf @@ -95,7 +95,7 @@ variable "interactive" { } variable "ipc_mode" { - default = "host" + default = null description = "The IPC resource namespace to use for the containers in the task" } @@ -144,7 +144,7 @@ variable "network_mode" { } variable "pid_mode" { - default = "host" + default = null description = "The process namespace to use for the containers in the task" }