Resource: aws_route53_health_check

Provides a Route53 health check.

Example Usage

Connectivity and HTTP Status Code Check

resource "aws_route53_health_check" "example" {
  fqdn              = "example.com"
  port              = 80
  type              = "HTTP"
  resource_path     = "/"
  failure_threshold = "5"
  request_interval  = "30"

  tags = {
    Name = "tf-test-health-check"
  }
}

Connectivity and String Matching Check

resource "aws_route53_health_check" "example" {
  failure_threshold = "5"
  fqdn              = "example.com"
  port              = 443
  request_interval  = "30"
  resource_path     = "/"
  search_string     = "example"
  type              = "HTTPS_STR_MATCH"
}

Aggregate Check

resource "aws_route53_health_check" "parent" {
  type                   = "CALCULATED"
  child_health_threshold = 1
  child_healthchecks     = [aws_route53_health_check.child.id]

  tags = {
    Name = "tf-test-calculated-health-check"
  }
}

CloudWatch Alarm Check

resource "aws_cloudwatch_metric_alarm" "foobar" {
  alarm_name          = "terraform-test-foobar5"
  comparison_operator = "GreaterThanOrEqualToThreshold"
  evaluation_periods  = "2"
  metric_name         = "CPUUtilization"
  namespace           = "AWS/EC2"
  period              = "120"
  statistic           = "Average"
  threshold           = "80"
  alarm_description   = "This metric monitors ec2 cpu utilization"
}

resource "aws_route53_health_check" "foo" {
  type                            = "CLOUDWATCH_METRIC"
  cloudwatch_alarm_name           = aws_cloudwatch_metric_alarm.foobar.alarm_name
  cloudwatch_alarm_region         = "us-west-2"
  insufficient_data_health_status = "Healthy"
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import Route53 Health Checks using the health check id. For example:

import {
  to = aws_route53_health_check.http_check
  id = "abcdef11-2222-3333-4444-555555fedcba"
}

Using terraform import, import Route53 Health Checks using the health check id. For example:

% terraform import aws_route53_health_check.http_check abcdef11-2222-3333-4444-555555fedcba