Aws_cloudwatch_metric_alarm

Hi

I have a synthetics canary configured courtesy of “maksymbilenko”, however when trying to create a resource for - aws_cloudwatch_metric_alarm i cannot see any options to refer to a canary, in the console it is called “canary_name” and i presume this might not be in the latest aws provider at this point?

oddly enough it does enable to me to add a - namespace = “CloudWatchSynthetics”

I have exactly the same issue could you figure it out?

With the namespace = “CloudWatchSynthetics” and adding the canary name to the dimensions you should be able to create the corresponding alarms. Like this:

resource “aws_cloudwatch_metric_alarm” “canary-alarm” {
alarm_name = “canary=alarms-${local.canary_name}”
comparison_operator = “LessThanThreshold”
evaluation_periods = “1”
metric_name = “SuccessPercent”
namespace = “CloudWatchSynthetics”
period = “300”
statistic = “Minimum”
threshold = “100”
alarm_description = “This alarm monitors the success rate of the ${local.canary_name} canary”
insufficient_data_actions =

dimensions = {
CanaryName = “${local.canary_name}”
}
}

1 Like

Thanks! Can we specify SNS topic as alarm_actions with this ? Would it work w/ Canary as dimension ?

I haven’t tried that, but I would expect it to work as with any other alarm.