generated from dxw/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs-cluster-infrastructure-alert-ecs-asg-diff.tf
25 lines (24 loc) · 1.49 KB
/
ecs-cluster-infrastructure-alert-ecs-asg-diff.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
resource "aws_cloudwatch_metric_alarm" "infrastructure_ecs_cluster_ecs_asg_diff" {
count = local.enable_infrastructure_ecs_cluster_ecs_asg_diff_alert ? 1 : 0
alarm_name = "${local.resource_prefix}-infrastructure-ecs-cluster-infrastructure-ecs-asg-diff"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = local.infrastructure_ecs_cluster_ecs_asg_diff_alert_evaluation_periods
metric_name = "ContainerInstanceAsgInstanceDiff"
namespace = "ECS"
period = local.infrastructure_ecs_cluster_ecs_asg_diff_alert_period
statistic = "Maximum"
threshold = local.infrastructure_ecs_cluster_ecs_asg_diff_alert_threshold
alarm_description = "Container Instance / ASG Instance Difference for ${aws_ecs_cluster.infrastructure[0].name} Cluster"
actions_enabled = "true"
alarm_actions = concat(
local.infrastructure_ecs_cluster_ecs_asg_diff_alert_slack ? [data.aws_sns_topic.infrastructure_slack_sns_topic[0].arn] : [],
local.infrastructure_ecs_cluster_ecs_asg_diff_alert_opsgenie ? [data.aws_sns_topic.infrastructure_opsgenie_sns_topic[0].arn] : []
)
ok_actions = concat(
local.infrastructure_ecs_cluster_ecs_asg_diff_alert_slack ? [data.aws_sns_topic.infrastructure_slack_sns_topic[0].arn] : [],
local.infrastructure_ecs_cluster_ecs_asg_diff_alert_opsgenie ? [data.aws_sns_topic.infrastructure_opsgenie_sns_topic[0].arn] : []
)
dimensions = {
ClusterName = aws_ecs_cluster.infrastructure[0].name
}
}