diff --git a/main.tf b/main.tf index 19339d44..74068bc5 100644 --- a/main.tf +++ b/main.tf @@ -1,6 +1,5 @@ locals { is_t_instance_type = "${replace(var.instance_type, "/^t[23]{1}\\..*$/", "1") == "1" ? "1" : "0"}" - instance_name = "${map("Name", (var.instance_count > 1) || (var.use_num_suffix == "true") ? format("%s-%d", var.name, count.index+1) : var.name)}" } ###### @@ -35,7 +34,7 @@ resource "aws_instance" "this" { placement_group = "${var.placement_group}" tenancy = "${var.tenancy}" - tags = "${merge(local.instance_name, var.tags)}" + tags = "${merge(map("Name", (var.instance_count > 1) || (var.use_num_suffix == "true") ? format("%s-%d", var.name, count.index+1) : var.name), var.tags)}" lifecycle { # Due to several known issues in Terraform AWS provider related to arguments of aws_instance: @@ -78,7 +77,7 @@ resource "aws_instance" "this_t2" { cpu_credits = "${var.cpu_credits}" } - tags = "${merge(local.instance_name, var.tags)}" + tags = "${merge(map("Name", (var.instance_count > 1) || (var.use_num_suffix == "true") ? format("%s-%d", var.name, count.index+1) : var.name), var.tags)}" lifecycle { # Due to several known issues in Terraform AWS provider related to arguments of aws_instance: