From c44351e21969040b67639b45473902ed179353a4 Mon Sep 17 00:00:00 2001 From: Sean Demura Date: Thu, 16 Oct 2025 15:16:32 -0400 Subject: [PATCH] fix: add tag propagation to autoscaling group instances 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. --- autoscaling_group.tf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autoscaling_group.tf b/autoscaling_group.tf index 33011d7..b6c55a1 100644 --- a/autoscaling_group.tf +++ b/autoscaling_group.tf @@ -24,6 +24,21 @@ resource "aws_autoscaling_group" "sensor_asg" { heartbeat_timeout = 300 } + tag { + key = "Name" + value = "${var.sensor_asg_name}-sensor" + propagate_at_launch = true + } + + dynamic "tag" { + for_each = var.tags + content { + key = tag.key + value = tag.value + propagate_at_launch = true + } + } + depends_on = [ aws_lambda_function.auto_scaling_lambda, aws_cloudwatch_event_rule.asg_lifecycle_rule,