Closed stevie- closed 1 month ago
if sns_topic is not set, the default is empty string "". This leads to null as an element added to the list which is a NOOP change. On each run, TF detects a drift and tries to add it.
sns_topic
we are using https://github.com/cn-terraform/terraform-aws-ecs-fargate-service version "2.0.43"
which uses this module version "1.0.9"
tf plan
# module.ecs_service.module.ecs-autoscaling[0].aws_cloudwatch_metric_alarm.cpu_high will be updated in-place ~ resource "aws_cloudwatch_metric_alarm" "cpu_high" { ~ alarm_actions = [ + null, # (1 unchanged element hidden) ]
better implemention would be this
alarm_actions = compact([ aws_appautoscaling_policy.scale_up_policy.arn, var.sns_topic_arn != "" ? var.sns_topic_arn : "" ])
or
alarm_actions = concat( [ aws_appautoscaling_policy.scale_up_policy.arn, ], var.sns_topic_arn != "" ? [var.sns_topic_arn] : [], )
PS: there is no way, to set sns_topic_arn within the service module. You may want to add the variable.
if
sns_topic
is not set, the default is empty string "". This leads to null as an element added to the list which is a NOOP change. On each run, TF detects a drift and tries to add it.we are using https://github.com/cn-terraform/terraform-aws-ecs-fargate-service version "2.0.43"
which uses this module version "1.0.9"
tf plan
better implemention would be this
or
PS: there is no way, to set sns_topic_arn within the service module. You may want to add the variable.