Skip to content
Start here

Healthchecks

resource cloudflare_healthcheck

required Expand Collapse
zone_id: String

Identifier

address: String

The hostname or IP address of the origin server to run health checks on.

name: String

A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.

optional Expand Collapse
description?: String

A human-readable description of the health check.

check_regions?: List[String]

A list of regions from which to run health checks. Null means Cloudflare will pick a default region.

consecutive_fails?: Int64

The number of consecutive fails required from a health check before changing the health to unhealthy.

consecutive_successes?: Int64

The number of consecutive successes required from a health check before changing the health to healthy.

interval?: Int64

The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.

retries?: Int64

The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.

suspended?: Bool

If suspended, no health checks are sent to the origin.

timeout?: Int64

The timeout (in seconds) before marking the health check as failed.

type?: String

The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.

http_config?: Attributes

Parameters specific to an HTTP or HTTPS health check.

allow_insecure?: Bool

Do not validate the certificate when the health check uses HTTPS.

expected_body?: String

A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.

expected_codes?: List[String]

The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.

follow_redirects?: Bool

Follow redirects if the origin returns a 3xx status code.

header?: Map[List[String]]

The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.

method?: String

The HTTP method to use for the health check.

path?: String

The endpoint path to health check against.

port?: Int64

Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.

tcp_config?: Attributes

Parameters specific to TCP health check.

method?: String

The TCP connection method to use for the health check.

port?: Int64

Port number to connect to for the health check. Defaults to 80.

computed Expand Collapse
id: String

Identifier

created_on: Time
failure_reason: String

The current failure reason if status is unhealthy.

modified_on: Time
status: String

The current status of the origin server according to the health check.

cloudflare_healthcheck

resource "cloudflare_healthcheck" "example_healthcheck" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  address = "www.example.com"
  name = "server-1"
  check_regions = ["WEU", "ENAM"]
  consecutive_fails = 0
  consecutive_successes = 0
  description = "Health check for www.example.com"
  http_config = {
    allow_insecure = true
    expected_body = "success"
    expected_codes = ["2xx", "302"]
    follow_redirects = true
    header = {
      Host = ["example.com"]
      X-App-ID = ["abc123"]
    }
    method = "GET"
    path = "/health"
    port = 0
  }
  interval = 0
  retries = 0
  suspended = true
  tcp_config = {
    method = "connection_established"
    port = 0
  }
  timeout = 0
  type = "HTTPS"
}

data cloudflare_healthcheck

required Expand Collapse
healthcheck_id: String

Identifier

zone_id: String

Identifier

computed Expand Collapse
id: String

Identifier

address: String

The hostname or IP address of the origin server to run health checks on.

consecutive_fails: Int64

The number of consecutive fails required from a health check before changing the health to unhealthy.

consecutive_successes: Int64

The number of consecutive successes required from a health check before changing the health to healthy.

created_on: Time
description: String

A human-readable description of the health check.

failure_reason: String

The current failure reason if status is unhealthy.

interval: Int64

The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.

modified_on: Time
name: String

A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.

retries: Int64

The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.

status: String

The current status of the origin server according to the health check.

suspended: Bool

If suspended, no health checks are sent to the origin.

timeout: Int64

The timeout (in seconds) before marking the health check as failed.

type: String

The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.

check_regions: List[String]

A list of regions from which to run health checks. Null means Cloudflare will pick a default region.

http_config: Attributes

Parameters specific to an HTTP or HTTPS health check.

allow_insecure: Bool

Do not validate the certificate when the health check uses HTTPS.

expected_body: String

A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.

expected_codes: List[String]

The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.

follow_redirects: Bool

Follow redirects if the origin returns a 3xx status code.

header: Map[List[String]]

The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.

method: String

The HTTP method to use for the health check.

path: String

The endpoint path to health check against.

port: Int64

Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.

tcp_config: Attributes

Parameters specific to TCP health check.

method: String

The TCP connection method to use for the health check.

port: Int64

Port number to connect to for the health check. Defaults to 80.

cloudflare_healthcheck

data "cloudflare_healthcheck" "example_healthcheck" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  healthcheck_id = "023e105f4ecef8ad9ca31a8372d0c353"
}

data cloudflare_healthchecks

required Expand Collapse
zone_id: String

Identifier

optional Expand Collapse
max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String

Identifier

address: String

The hostname or IP address of the origin server to run health checks on.

check_regions: List[String]

A list of regions from which to run health checks. Null means Cloudflare will pick a default region.

consecutive_fails: Int64

The number of consecutive fails required from a health check before changing the health to unhealthy.

consecutive_successes: Int64

The number of consecutive successes required from a health check before changing the health to healthy.

created_on: Time
description: String

A human-readable description of the health check.

failure_reason: String

The current failure reason if status is unhealthy.

http_config: Attributes

Parameters specific to an HTTP or HTTPS health check.

allow_insecure: Bool

Do not validate the certificate when the health check uses HTTPS.

expected_body: String

A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.

expected_codes: List[String]

The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.

follow_redirects: Bool

Follow redirects if the origin returns a 3xx status code.

header: Map[List[String]]

The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.

method: String

The HTTP method to use for the health check.

path: String

The endpoint path to health check against.

port: Int64

Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.

interval: Int64

The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.

modified_on: Time
name: String

A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.

retries: Int64

The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.

status: String

The current status of the origin server according to the health check.

suspended: Bool

If suspended, no health checks are sent to the origin.

tcp_config: Attributes

Parameters specific to TCP health check.

method: String

The TCP connection method to use for the health check.

port: Int64

Port number to connect to for the health check. Defaults to 80.

timeout: Int64

The timeout (in seconds) before marking the health check as failed.

type: String

The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.

cloudflare_healthchecks

data "cloudflare_healthchecks" "example_healthchecks" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
}