Skip to content

Commit

Permalink
fix issue: int128#16, tag ordering (int128#17)
Browse files Browse the repository at this point in the history
* fix issue: int128#16, tag ordering

* Refactor: tidy up

Co-authored-by: Hidetake Iwata <[email protected]>
  • Loading branch information
nelg and int128 authored May 28, 2020
1 parent 0aac098 commit 5c37031
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
17 changes: 16 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,22 @@ resource "aws_autoscaling_group" "this" {
}
}

tags = local.asg_tags
// Generate asg tags from default tag list
dynamic "tag" {
for_each = var.tags
content {
key = tag.key
value = tag.value
propagate_at_launch = true
}
}

// Tag for name
tag {
key = "Name"
value = "nat-instance-${var.name}"
propagate_at_launch = true
}

lifecycle {
create_before_destroy = true
Expand Down
16 changes: 0 additions & 16 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,4 @@ locals {
var.tags, {
Name = "nat-instance-${var.name}"
})

// Generate asg tags by merging variables in object format
asg_tags = concat([
for key, value in var.tags : {
key = key
value = value
propagate_at_launch = true
}
], [
{
key = "Name"
value = "nat-instance-${var.name}"
propagate_at_launch = true
}
]
)
}

0 comments on commit 5c37031

Please sign in to comment.