From 36b5b2af40a6d4de640246ec223e6eccd395df12 Mon Sep 17 00:00:00 2001 From: Guillaume GILL Date: Thu, 1 Oct 2020 16:40:28 +0200 Subject: [PATCH 1/2] CPU credits could be removed from launch template (permit launch of non burstable families) --- workers_launch_template.tf | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/workers_launch_template.tf b/workers_launch_template.tf index 600666a11d..0af41c43de 100644 --- a/workers_launch_template.tf +++ b/workers_launch_template.tf @@ -304,12 +304,19 @@ resource "aws_launch_template" "workers_launch_template" { ) } - credit_specification { - cpu_credits = lookup( + dynamic "credit_specification" { + for_each = lookup( var.worker_groups_launch_template[count.index], "cpu_credits", local.workers_group_defaults["cpu_credits"] - ) + ) != null ? [{}] : [] + content { + cpu_credits = lookup( + var.worker_groups_launch_template[count.index], + "cpu_credits", + local.workers_group_defaults["cpu_credits"] + ) + } } monitoring { From 91c9823b42a2fc5a443c00296979807bb31ac4ca Mon Sep 17 00:00:00 2001 From: Guillaume GILL Date: Sun, 4 Oct 2020 22:41:07 +0200 Subject: [PATCH 2/2] Fix code syntax --- workers_launch_template.tf | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/workers_launch_template.tf b/workers_launch_template.tf index 0af41c43de..d6f5d03c0b 100644 --- a/workers_launch_template.tf +++ b/workers_launch_template.tf @@ -309,13 +309,9 @@ resource "aws_launch_template" "workers_launch_template" { var.worker_groups_launch_template[count.index], "cpu_credits", local.workers_group_defaults["cpu_credits"] - ) != null ? [{}] : [] + ) != null ? [lookup(var.worker_groups_launch_template[count.index], "cpu_credits", local.workers_group_defaults["cpu_credits"])] : [] content { - cpu_credits = lookup( - var.worker_groups_launch_template[count.index], - "cpu_credits", - local.workers_group_defaults["cpu_credits"] - ) + cpu_credits = credit_specification.value } }