Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
rfairburn committed Mar 14, 2024
1 parent 6e20374 commit 8e04c14
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions terraform/addons/monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ resource "aws_db_event_subscription" "default" {

}

locals {
alb_map = {for k, v in var.albs: k => v}
}


// ECS Alarms
resource "aws_cloudwatch_metric_alarm" "alb_healthyhosts" {
for_each = toset(var.albs)
for_each = local.alb_map
alarm_name = "backend-healthyhosts-${var.customer_prefix}-${each.value.name}"
comparison_operator = "LessThanThreshold"
evaluation_periods = "1"
Expand All @@ -59,7 +64,7 @@ resource "aws_cloudwatch_metric_alarm" "alb_healthyhosts" {

// alarm for target response time (anomaly detection)
resource "aws_cloudwatch_metric_alarm" "target_response_time" {
for_each = toset(var.albs)
for_each = local.alb_map
alarm_name = "backend-target-response-time-${var.customer_prefix}-${each.value.name}"
comparison_operator = "GreaterThanUpperThreshold"
evaluation_periods = "2"
Expand Down

0 comments on commit 8e04c14

Please sign in to comment.