diff --git a/aws/cloudwatch/alarm.tf b/aws/cloudwatch/alarm.tf index bca2241a..b84902ec 100644 --- a/aws/cloudwatch/alarm.tf +++ b/aws/cloudwatch/alarm.tf @@ -21,7 +21,7 @@ resource "aws_cloudwatch_metric_alarm" "cluster_cpu" { # This alarm is only available when the container insights are enabled in the ECS resource "aws_cloudwatch_metric_alarm" "running_instance_count" { - count = var.enable_container_insights + count = var.enable_container_insights ? 1 : 0 alarm_name = "${var.project}-${var.environment}-ecs-service-${var.database_identifiers[count.index]}" alarm_description = "Alert when zero running instance"