File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ variable "asg_memory_target" {
7575 description = " Target average memory percentage to track for autoscaling"
7676}
7777
78- variable "alarm_sns_topic " {
79- default = " "
80- description = " Alarm topic to create and alert on ECS cluster metrics"
78+ variable "alarm_sns_topics " {
79+ default = []
80+ description = " Alarm topics to create and alert on ECS instance metrics"
8181}
Original file line number Diff line number Diff line change 11resource "aws_cloudwatch_metric_alarm" "high_memory" {
2- count = " ${ var . alarm_sns_topic == " " ? 0 : 1 } "
2+ count = " ${ length ( var. alarm_sns_topics ) > 0 ? 1 : 0 } "
33
44 alarm_name = " ${ data . aws_iam_account_alias . current . account_alias } -ecs-${ var . name } -high-memory"
55 comparison_operator = " GreaterThanOrEqualToThreshold"
@@ -10,15 +10,16 @@ resource "aws_cloudwatch_metric_alarm" "high_memory" {
1010 statistic = " Maximum"
1111 threshold = " 80"
1212 alarm_description = " Cluster node memory above threshold"
13- alarm_actions = [" ${ var . alarm_sns_topic } " ]
13+ alarm_actions = var. alarm_sns_topics
14+ ok_actions = var. alarm_sns_topics
1415
1516 dimensions = {
1617 ClusterName = " ${ aws_ecs_cluster . ecs . name } "
1718 }
1819}
1920
2021resource "aws_cloudwatch_metric_alarm" "high_cpu" {
21- count = " ${ var . alarm_sns_topic == " " ? 0 : 1 } "
22+ count = " ${ length ( var. alarm_sns_topics ) > 0 ? 1 : 0 } "
2223
2324 alarm_name = " ${ data . aws_iam_account_alias . current . account_alias } -ecs-${ var . name } -high-cpu"
2425 comparison_operator = " GreaterThanOrEqualToThreshold"
@@ -29,7 +30,8 @@ resource "aws_cloudwatch_metric_alarm" "high_cpu" {
2930 statistic = " Maximum"
3031 threshold = " 80"
3132 alarm_description = " Cluster node CPU above threshold"
32- alarm_actions = [" ${ var . alarm_sns_topic } " ]
33+ alarm_actions = var. alarm_sns_topics
34+ ok_actions = var. alarm_sns_topics
3335
3436 dimensions = {
3537 ClusterName = " ${ aws_ecs_cluster . ecs . name } "
You can’t perform that action at this time.
0 commit comments