Skip to content

Commit

Permalink
(Fix) Ensure tags is only provided once in aws_autoscaling_group
Browse files Browse the repository at this point in the history
  • Loading branch information
Stretch96 committed Aug 1, 2019
1 parent 4a41e9c commit 530d3c8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ resource "aws_launch_configuration" "ecs" {
}
}

locals {
ecs_asg_tags_init = [{
key = "Name"
value = "${var.name} ${var.tagName}"
propagate_at_launch = true
}]

ecs_asg_tags = "${concat(local.ecs_asg_tags_init, var.extra_tags)}"
}

resource "aws_autoscaling_group" "ecs" {
name_prefix = "asg-${aws_launch_configuration.ecs.name}-"
vpc_zone_identifier = ["${var.subnet_id}"]
Expand All @@ -59,13 +69,7 @@ resource "aws_autoscaling_group" "ecs" {
load_balancers = ["${var.load_balancers}"]
enabled_metrics = ["${var.enabled_metrics}"]

tags = [{
key = "Name"
value = "${var.name} ${var.tagName}"
propagate_at_launch = true
}]

tags = ["${var.extra_tags}"]
tags = ["${local.ecs_asg_tags}"]

lifecycle {
create_before_destroy = true
Expand Down

0 comments on commit 530d3c8

Please sign in to comment.