Skip to content

Commit 6ce307b

Browse files
sdemuracorelight-sdthathaneydude
authored
fix: add tag propagation to autoscaling group instances (#22)
Add Name tag and dynamic tag blocks to the sensor autoscaling group to ensure tags are properly propagated to EC2 instances at launch. This enables better resource identification and organization of sensor instances within the ASG. Co-authored-by: Sean Demura <sean.demura@corelight.com> Co-authored-by: Ryan Haney <25014745+thathaneydude@users.noreply.github.com>
1 parent 1c231df commit 6ce307b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

autoscaling_group.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ resource "aws_autoscaling_group" "sensor_asg" {
2424
heartbeat_timeout = 300
2525
}
2626

27+
tag {
28+
key = "Name"
29+
value = "${var.sensor_asg_name}-sensor"
30+
propagate_at_launch = true
31+
}
32+
33+
dynamic "tag" {
34+
for_each = var.tags
35+
content {
36+
key = tag.key
37+
value = tag.value
38+
propagate_at_launch = true
39+
}
40+
}
41+
2742
depends_on = [
2843
aws_lambda_function.auto_scaling_lambda,
2944
aws_cloudwatch_event_rule.asg_lifecycle_rule,

0 commit comments

Comments
 (0)