Commit a73ceb8d authored by Olivier TASSETTI's avatar Olivier TASSETTI

Modify tag name management to add -%d suffixe only if instance_count > 1

parent 43b413b4
...@@ -33,7 +33,7 @@ resource "aws_instance" "this" { ...@@ -33,7 +33,7 @@ resource "aws_instance" "this" {
# Note: network_interface can't be specified together with associate_public_ip_address # Note: network_interface can't be specified together with associate_public_ip_address
# network_interface = "${var.network_interface}" # network_interface = "${var.network_interface}"
tags = "${merge(var.tags, map("Name", format("%s-%d", var.name, count.index+1)))}" tags = "${merge(var.tags, map("Name", var.instance_count > 1 ? format("%s-%d", var.name, count.index+1):var.name))}"
lifecycle { lifecycle {
# Due to several known issues in Terraform AWS provider related to arguments of aws_instance: # Due to several known issues in Terraform AWS provider related to arguments of aws_instance:
# (eg, https://github.com/terraform-providers/terraform-provider-aws/issues/2036) # (eg, https://github.com/terraform-providers/terraform-provider-aws/issues/2036)
......
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