I'm trying to create an alarm when an SQS has 50+ messages visible. I'm unfortunately getting the following error from terraform apply.
Error: Creating metric alarm failed: ValidationError: Period (10) not supported
I looked for value restrictions in terraform.io => https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm
as well as aws docs -> https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html
My terraform is as follows
resource "aws_cloudwatch_metric_alarm" "aggregator-threshold-ceiling-alarm" {
count = var.tagging_environment == "int" ? 1 : 0
alarm_name = "aggregator-queue-depth-ceiling-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "ApproximateNumberOfMessagesVisible"
namespace = "AWS/SQS"
period = "10"
statistic = "Maximum"
threshold = "50"
treat_missing_data = "notBreaching"
dimensions = {
QueueName = "${module.sqs_client-comm-aggregator.main-queue-name}"
}
alarm_description = "This metric monitors queue depth and scales up or down accordingly."
alarm_actions = ["${module.sns_cx-clientcomm-load-indicator-lambda-aggregator.topic_arn}"]
}