Aws_route53_health_check and aws_cloudwatch_composite_alarm

Hi, all,

I created a composite alarm that combines checks of all target groups in my ALB into a single health check, and I want to use that alarm to trigger a route53 failover event. But I am not able to use an aws_cloudwatch_composite_alarm for the cloudwatch_alarm_name in the aws_route53_health_check resource. E.g.

resource "aws_cloudwatch_composite_alarm" "route53_status_alarm" {
  alarm_name = "my-route53-status-alarm"
  alarm_description = "Alert if any target group in ${} ${var.alb.env} is unhealthy. Used to trigger Route53 failover."
  alarm_rule = join(" OR ", formatlist("ALARM(%s)", [for a in aws_cloudwatch_metric_alarm.hostcount_alarm: a.alarm_name]))

  tags = {
    Name = "my-route53-status-alarm"

  depends_on = [ aws_cloudwatch_metric_alarm.hostcount_alarm ] # this is a for_each created list of hostcount alarms for each TG

resource "aws_route53_health_check" "alb_health_check" {
  cloudwatch_alarm_name = aws_cloudwatch_composite_alarm.route53_status_alarm.alarm_name
  cloudwatch_alarm_region =
  insufficient_data_health_status = "Healthy"
  tags = {
    Name = "my-health-check"
  depends_on = [ aws_cloudwatch_composite_alarm.route53_status_alarm ]

Is a composite alarm usable in route 53? Or only single aws_cloudwatch_metric_alarms?



I got this working using parent/child route_53_health_checks. I’ll assume that aws_cloudwatch_composite_alarm can’t be used in a route53_health_check.