resource "aws_cloudwatch_metric_alarm" "redis-alarms" { for_each = var.settings alarm_name = "${each.value["ecccode"]}-Redis_${var.redis-cluster-id}-${each.value["metric"]}" comparison_operator = each.value["comparison_operator"] evaluation_periods = each.value["evaluation_periods"] metric_name = each.value["metric"] period = each.value["period"] statistic = each.value["statistic"] threshold = each.value["threshold"] alarm_description = "ElastiCache:${each.value["metric"]}" namespace = "AWS/ElastiCache" insufficient_data_actions = [] actions_enabled = var.actions-enabled alarm_actions = [each.value["action"]] ok_actions = [each.value["action"]] treat_missing_data = "notBreaching" dimensions = { CacheClusterId = var.redis-cluster-id } }