forked from DNXLabs/terraform-aws-eb-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloutwatch-alarms-asg.tf
21 lines (19 loc) · 998 Bytes
/
cloutwatch-alarms-asg.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
resource "aws_cloudwatch_metric_alarm" "asg_high_cpu" {
count = length(var.alarm_sns_topics) > 0 && var.alarm_asg_high_cpu_threshold != 0 ? 1 : 0
alarm_name = "${var.ignore_iam_account_alias[0] ? "eb-${var.name}-asg-high-cpu" : data.aws_iam_account_alias.current[0]}-eb-${var.name}-${var.environment}-asg-high-cpu"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "3"
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "120"
statistic = "Average"
threshold = var.alarm_asg_high_cpu_threshold
alarm_description = "ASG CPU above threshold"
alarm_actions = var.alarm_sns_topics
ok_actions = var.alarm_sns_topics
insufficient_data_actions = []
treat_missing_data = "ignore"
dimensions = {
AutoScalingGroupName = aws_elastic_beanstalk_environment.env.autoscaling_groups[0]
}
}