Skip to content

Commit 09b3b6b

Browse files
authored
Merge pull request #4 from gaussb-labs/feature/allow-additional-tags-asg-instances
feat: add support for additional tags in auto-scaling-group that can be attached to EC2 instances at launch
2 parents 38fbcef + 1dd2d3d commit 09b3b6b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

auto_scaling_groups.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ resource "aws_autoscaling_group" "ecs_cluster_asg" {
3636
propagate_at_launch = true
3737
value = var.environment
3838
}
39+
dynamic "tag" {
40+
for_each = each.value.additional_tags
41+
content {
42+
key = tag.value.key
43+
value = tag.value.value
44+
propagate_at_launch = tag.value.propagate_at_launch
45+
}
46+
}
3947
lifecycle {
4048
create_before_destroy = true
4149
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,15 @@ variable "asg" {
2424
max_size = number
2525
min_size = number
2626
protect_from_scale_in = bool
27+
additional_tags = list(object({
28+
key = string
29+
value = string
30+
propagate_at_launch = bool
31+
}))
2732
}))
2833
description = "Autoscaling group configuration."
2934
}
35+
3036
variable "launch_configs" {
3137
type = list(object({
3238
name = string

0 commit comments

Comments
 (0)