Open MagnusSafty opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Working example could look like this
resource "aws_route53_health_check" "example" {
fqdn = example.com
port = 443
resource_path = "/"
failure_threshold = "3"
request_interval = "30"
search_string = "ok"
type = "HTTPS_STR_MATCH"
}
resource "aws_cloudwatch_metric_alarm" "example" {
provider = aws.useast1
alarm_name = "Down: ${aws_route53_health_check.example.fqdn}"
comparison_operator = "LessThanThreshold"
evaluation_periods = "2"
metric_name = "HealthCheckStatus"
namespace = "AWS/Route53"
period = "60"
statistic = "Minimum"
threshold = "1"
dimensions = {
HealthCheckId = aws_route53_health_check.example.id
}
}
Hey @MagnusSafty 👋 Thank you for taking the time to raise this! The example you provided looks like a CloudWatch metric alarm that monitors a Route53 health check, whereas the example in the documentation as it stands is a Route53 health check that monitors a CloudWatch alarm (so, inverted). Unless I'm missing something (which I'm always open to!), it seems to me that both are valid configurations, however, the existing example seems like it's more relevant to the aws_route53_health_check
resource's documentation. Does that line up with your read on the linked documents, or have I missed something here?
@MagnusSafty I just wanted to thank you for writing this! I was struggling with very same thing and I agree the "official" terraform example is backward. Most people want the cloudwatch metric to monitor their route53 alarm as you have suggested, I have never encountered a use case which is the other way round. The terraform example should be updated to match your suggestion
I agree with @justinretzolk: The existing documentation is valid, and is more directly related to "the ways you can configure a route53 health check" (the opposite way is much more related to "how to configure a cloudwatch alarm to point at a route53 health check")
Documentation Link
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_health_check#cloudwatch-alarm-check
Description
The example that is given for aws_cloudwatch_metric_alarm is monitoring CPU and not the health check.
References
No response
Would you like to implement a fix?
No