1 resource "aws_cloudwatch_metric_alarm" "unconsumed" {
2 alarm_name = "${length(var.sqs_events_name) > 0 ? var.sqs_events_name : var.management_service_name}${length(var.sqs_events_name) > 0 ? "" : "-events"}-unconsumed"
3 alarm_description = "Alert when queue has aging messages."
4 metric_name = "ApproximateAgeOfOldestMessage"
5 comparison_operator = "GreaterThanOrEqualToThreshold"
6 evaluation_periods = 10
12 QueueName = "${length(var.sqs_events_name) > 0 ? var.sqs_events_name : var.management_service_name}${length(var.sqs_events_name) > 0 ? "" : "-events"}"
14 alarm_actions = ["${aws_sns_topic.management-alerts.arn}"]
17 resource "aws_cloudwatch_metric_alarm" "failures-present" {
18 alarm_name = "${length(var.sqs_events_name) > 0 ? var.sqs_events_name : var.management_service_name}${length(var.sqs_events_name) > 0 ? "" : "-events"}-failed-present"
19 alarm_description = "Alert when a message has failed."
20 metric_name = "ApproximateNumberOfMessagesVisible"
21 comparison_operator = "GreaterThanOrEqualToThreshold"
22 evaluation_periods = 2
28 QueueName = "${length(var.sqs_events_name) > 0 ? var.sqs_events_name : var.management_service_name}${length(var.sqs_events_name) > 0 ? "" : "-events"}-failed"
30 alarm_actions = ["${aws_sns_topic.management-alerts.arn}"]