From fafb34503c957544ae6600c8fa0b1a42b66a31d3 Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 10:24:06 -0500 Subject: [PATCH 1/7] remove extra brackets around aws_launch_configuration.ecs security groups --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index efa14b2..45b159c 100644 --- a/main.tf +++ b/main.tf @@ -38,7 +38,7 @@ resource "aws_launch_configuration" "ecs" { # If the expression in the following list itself returns a list, remove the # brackets to avoid interpretation as a list of lists. If the expression # returns a single list item then leave it as-is and remove this TODO comment. - security_groups = [concat([aws_security_group.ecs.id], var.security_group_ids)] + security_groups = concat([aws_security_group.ecs.id], var.security_group_ids) associate_public_ip_address = var.associate_public_ip_address spot_price = var.spot_bid_price From cd7b21abf08a811ae24a9d4b4066bceba9fcfa8f Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 10:32:18 -0500 Subject: [PATCH 2/7] mulitple formats in tag block: --- main.tf | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/main.tf b/main.tf index 45b159c..e49e5f6 100644 --- a/main.tf +++ b/main.tf @@ -110,11 +110,7 @@ resource "aws_autoscaling_group" "ecs" { enabled_metrics = var.enabled_metrics tags = merge( - { - "key" = "Name" - "value" = "${var.name} ${var.tagName}" - "propagate_at_launch" = true - }, + map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch", true), var.extra_tags, ) From 7c19cd6a37a1dbf7aea915c9240c0d92a1f5dee1 Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 14:08:49 -0500 Subject: [PATCH 3/7] replaced merge method in main.tf 113 with a flatten and concat --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index e49e5f6..6fe54c5 100644 --- a/main.tf +++ b/main.tf @@ -109,9 +109,9 @@ resource "aws_autoscaling_group" "ecs" { load_balancers = var.load_balancers enabled_metrics = var.enabled_metrics - tags = merge( + tags = concat( map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch", true), - var.extra_tags, + flatten(var.extra_tags) ) lifecycle { From 3c6835e9212152462e7341afab39dd40c24e04d1 Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 14:11:26 -0500 Subject: [PATCH 4/7] merge was the right function so replaced the added concat with merge, kept the flatten --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 6fe54c5..916c22d 100644 --- a/main.tf +++ b/main.tf @@ -109,7 +109,7 @@ resource "aws_autoscaling_group" "ecs" { load_balancers = var.load_balancers enabled_metrics = var.enabled_metrics - tags = concat( + tags = merge( map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch", true), flatten(var.extra_tags) ) From 2494f53f97a7c37df726313827ea67b4782ff707 Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 14:15:53 -0500 Subject: [PATCH 5/7] changed the map to a json block and rmeoved the flatten --- main.tf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 916c22d..45b159c 100644 --- a/main.tf +++ b/main.tf @@ -110,8 +110,12 @@ resource "aws_autoscaling_group" "ecs" { enabled_metrics = var.enabled_metrics tags = merge( - map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch", true), - flatten(var.extra_tags) + { + "key" = "Name" + "value" = "${var.name} ${var.tagName}" + "propagate_at_launch" = true + }, + var.extra_tags, ) lifecycle { From 249d455efb524c737f8ac7ac368f76cd5c8edc00 Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 14:23:57 -0500 Subject: [PATCH 6/7] changed back to a map and wrapped in quotes and curly brackets --- main.tf | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/main.tf b/main.tf index 45b159c..296df79 100644 --- a/main.tf +++ b/main.tf @@ -109,14 +109,10 @@ resource "aws_autoscaling_group" "ecs" { load_balancers = var.load_balancers enabled_metrics = var.enabled_metrics - tags = merge( - { - "key" = "Name" - "value" = "${var.name} ${var.tagName}" - "propagate_at_launch" = true - }, + tags = "${merge( + map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch",true), var.extra_tags, - ) + )}" lifecycle { create_before_destroy = true @@ -140,14 +136,11 @@ resource "aws_autoscaling_group" "ecs_second" { load_balancers = var.load_balancers enabled_metrics = var.enabled_metrics - tags = merge( - { - "key" = "Name" - "value" = "${var.name} ${var.tagName} Second" - "propagate_at_launch" = true - }, + + tags = "${merge( + map("key","Name","value","${var.name} ${var.tagName} Second","propagate_at_launch",true), var.extra_tags, - ) + )}" lifecycle { create_before_destroy = true From 36b9e572062e70ac2d3ed459d0678f9367bcfbae Mon Sep 17 00:00:00 2001 From: Falpangaea Date: Thu, 2 Jan 2020 14:28:43 -0500 Subject: [PATCH 7/7] changed merge to concat and made the singular map a list --- main.tf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.tf b/main.tf index 296df79..4a18b35 100644 --- a/main.tf +++ b/main.tf @@ -109,10 +109,10 @@ resource "aws_autoscaling_group" "ecs" { load_balancers = var.load_balancers enabled_metrics = var.enabled_metrics - tags = "${merge( - map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch",true), - var.extra_tags, - )}" + tags = concat( + [map("key","Name","value","${var.name} ${var.tagName}","propagate_at_launch",true)], + var.extra_tags + ) lifecycle { create_before_destroy = true @@ -137,10 +137,10 @@ resource "aws_autoscaling_group" "ecs_second" { enabled_metrics = var.enabled_metrics - tags = "${merge( - map("key","Name","value","${var.name} ${var.tagName} Second","propagate_at_launch",true), - var.extra_tags, - )}" + tags = concat( + [map("key","Name","value","${var.name} ${var.tagName} Second","propagate_at_launch",true)], + var.extra_tags + ) lifecycle { create_before_destroy = true