Can we add a tags input to the aws_appautoscaling_policy and apply those tags to the target tracking alarms that get created?
CloudWatch TargetTracking alarms created by the aws_appautoscaling_policy resource don't have tags and I don't see an argument to add them in the resource. Tags added using default_tags in the aws provider block don't get added to the alarms either. It seems like this should be possible because "alarm_arns" is one of the attributes exported by the resource.
Affected Resource(s) and/or Data Source(s)
aws_appautoscaling_policy
Potential Terraform Configuration
resource "aws_appautoscaling_target" "ecs_target" {
max_capacity = 4
min_capacity = 1
resource_id = "service/clusterName/serviceName"
scalable_dimension = "ecs:service:DesiredCount"
service_namespace = "ecs"
}
resource "aws_appautoscaling_policy" "example" {
name = "foo"
policy_type = "TargetTrackingScaling"
resource_id = aws_appautoscaling_target.ecs_target.resource_id
scalable_dimension = aws_appautoscaling_target.ecs_target.scalable_dimension
service_namespace = aws_appautoscaling_target.ecs_target.service_namespace
tags {
mytag = "value"
}
target_tracking_scaling_policy_configuration {
target_value = 100
customized_metric_specification {
metrics {
label = "Get the queue size (the number of messages waiting to be processed)"
id = "m1"
metric_stat {
metric {
metric_name = "ApproximateNumberOfMessagesVisible"
namespace = "AWS/SQS"
dimensions {
name = "QueueName"
value = "my-queue"
}
}
stat = "Sum"
}
return_data = false
}
metrics {
label = "Get the ECS running task count (the number of currently running tasks)"
id = "m2"
metric_stat {
metric {
metric_name = "RunningTaskCount"
namespace = "ECS/ContainerInsights"
dimensions {
name = "ClusterName"
value = "default"
}
dimensions {
name = "ServiceName"
value = "web-app"
}
}
stat = "Average"
}
return_data = false
}
metrics {
label = "Calculate the backlog per instance"
id = "e1"
expression = "m1 / m2"
return_data = true
}
}
}
}
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Description
Can we add a tags input to the aws_appautoscaling_policy and apply those tags to the target tracking alarms that get created?
CloudWatch TargetTracking alarms created by the aws_appautoscaling_policy resource don't have tags and I don't see an argument to add them in the resource. Tags added using default_tags in the aws provider block don't get added to the alarms either. It seems like this should be possible because "alarm_arns" is one of the attributes exported by the resource.
Affected Resource(s) and/or Data Source(s)
aws_appautoscaling_policy
Potential Terraform Configuration
References
No response
Would you like to implement a fix?
No