Commit 1962a4fd authored by Denis Iskandarov's avatar Denis Iskandarov Committed by Anton Babenko

fix count variables are only valid within resources (#72)

Signed-off-by: default avatarDenis Iskandarov <d.iskandarov@gmail.com>
parent 54358edb
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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment