I’ve been trying for a few days now to use Terraform to create Route53 Health Checks along with accompanying Cloudwatch Alarms, SNS Topics, and subscribers. I’ve tried creating the config manually. I’ve tried using 5 different route53 health check modules. And I’ve tried building it by hand and exporting via Former2.
When I set up the check/alarm manually, the check gets created in global, and the alarm defaults to us-east-1, even though my entire infrastructure is in us-east-2. I’ve tried forcing the check/alarm to both us-east-1 and us-east2 with no luck.
Here’s my current iteration, which creates the check and the alarm, but does not link them together even though they reference one another. The Health Check shows no alarms configured, but the alarm has the correct ID for the corresponding check. The alarm receives no data despite this reference.
resource "aws_cloudwatch_metric_alarm" "CloudWatchAlarm" {
alarm_name = "My Alarm"
alarm_description = "My Alarm"
actions_enabled = true
alarm_actions = [
aws_sns_topic.Route53HealthChecks.arn
]
metric_name = "HealthCheckStatus"
namespace = "AWS/Route53"
statistic = "Minimum"
dimensions = {
HealthCheckId = aws_route53_health_check.Route53HealthCheck.id
}
period = 60
evaluation_periods = 1
threshold = 1
comparison_operator = "LessThanThreshold"
}
resource "aws_route53_health_check" "Route53HealthCheck" {
enable_sni = true
failure_threshold = 3
fqdn = "www.mysite.us"
invert_healthcheck = false
port = 443
request_interval = 30
resource_path = "/"
measure_latency = true
type = "HTTPS"
cloudwatch_alarm_name = "My Alarm"
cloudwatch_alarm_region = "us-east-2"
tags = {
Name = "My Health Check"
}
}
I searched these forums, Google, and Terraform’s GitHub Issues, but didn’t find anything. Am I doing something wrong? Are my expectations wrong? Is something else broken?
Thanks in advance!