Skip to content
This repository was archived by the owner on Jul 20, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5c37031

Browse files
nelgint128
andauthoredMay 28, 2020
fix issue: #16, tag ordering (#17)
* fix issue: #16, tag ordering * Refactor: tidy up Co-authored-by: Hidetake Iwata <int128@gmail.com>
1 parent 0aac098 commit 5c37031

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed
 

‎main.tf

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,22 @@ resource "aws_autoscaling_group" "this" {
124124
}
125125
}
126126

127-
tags = local.asg_tags
127+
// Generate asg tags from default tag list
128+
dynamic "tag" {
129+
for_each = var.tags
130+
content {
131+
key = tag.key
132+
value = tag.value
133+
propagate_at_launch = true
134+
}
135+
}
136+
137+
// Tag for name
138+
tag {
139+
key = "Name"
140+
value = "nat-instance-${var.name}"
141+
propagate_at_launch = true
142+
}
128143

129144
lifecycle {
130145
create_before_destroy = true

‎variables.tf

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,4 @@ locals {
7272
var.tags, {
7373
Name = "nat-instance-${var.name}"
7474
})
75-
76-
// Generate asg tags by merging variables in object format
77-
asg_tags = concat([
78-
for key, value in var.tags : {
79-
key = key
80-
value = value
81-
propagate_at_launch = true
82-
}
83-
], [
84-
{
85-
key = "Name"
86-
value = "nat-instance-${var.name}"
87-
propagate_at_launch = true
88-
}
89-
]
90-
)
9175
}

0 commit comments

Comments
 (0)
This repository has been archived.