HealthcheckArgs

data class HealthcheckArgs(val address: Output<String>? = null, val allowInsecure: Output<Boolean>? = null, val checkRegions: Output<List<String>>? = null, val consecutiveFails: Output<Int>? = null, val consecutiveSuccesses: Output<Int>? = null, val description: Output<String>? = null, val expectedBody: Output<String>? = null, val expectedCodes: Output<List<String>>? = null, val followRedirects: Output<Boolean>? = null, val headers: Output<List<HealthcheckHeaderArgs>>? = null, val interval: Output<Int>? = null, val method: Output<String>? = null, val name: Output<String>? = null, val path: Output<String>? = null, val port: Output<Int>? = null, val retries: Output<Int>? = null, val suspended: Output<Boolean>? = null, val timeout: Output<Int>? = null, val type: Output<String>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<HealthcheckArgs>

Standalone Health Checks provide a way to monitor origin servers without needing a Cloudflare Load Balancer.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
// HTTPS Healthcheck
const httpHealthCheck = new cloudflare.Healthcheck("http_health_check", {
zoneId: cloudflareZoneId,
name: "http-health-check",
description: "example http health check",
address: "example.com",
suspended: false,
checkRegions: [
"WEU",
"EEU",
],
type: "HTTPS",
port: 443,
method: "GET",
path: "/health",
expectedBody: "alive",
expectedCodes: [
"2xx",
"301",
],
followRedirects: true,
allowInsecure: false,
headers: [{
header: "Host",
values: ["example&#46;com"],
}],
timeout: 10,
retries: 2,
interval: 60,
consecutiveFails: 3,
consecutiveSuccesses: 2,
});
// TCP Healthcheck
const tcpHealthCheck = new cloudflare.Healthcheck("tcp_health_check", {
zoneId: cloudflareZoneId,
name: "tcp-health-check",
description: "example tcp health check",
address: "example.com",
suspended: false,
checkRegions: [
"WEU",
"EEU",
],
type: "TCP",
port: 22,
method: "connection_established",
timeout: 10,
retries: 2,
interval: 60,
consecutiveFails: 3,
consecutiveSuccesses: 2,
});
import pulumi
import pulumi_cloudflare as cloudflare
# HTTPS Healthcheck
http_health_check = cloudflare.Healthcheck("http_health_check",
zone_id=cloudflare_zone_id,
name="http-health-check",
description="example http health check",
address="example.com",
suspended=False,
check_regions=[
"WEU",
"EEU",
],
type="HTTPS",
port=443,
method="GET",
path="/health",
expected_body="alive",
expected_codes=[
"2xx",
"301",
],
follow_redirects=True,
allow_insecure=False,
headers=[{
"header": "Host",
"values": ["example&#46;com"],
}],
timeout=10,
retries=2,
interval=60,
consecutive_fails=3,
consecutive_successes=2)
# TCP Healthcheck
tcp_health_check = cloudflare.Healthcheck("tcp_health_check",
zone_id=cloudflare_zone_id,
name="tcp-health-check",
description="example tcp health check",
address="example.com",
suspended=False,
check_regions=[
"WEU",
"EEU",
],
type="TCP",
port=22,
method="connection_established",
timeout=10,
retries=2,
interval=60,
consecutive_fails=3,
consecutive_successes=2)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
// HTTPS Healthcheck
var httpHealthCheck = new Cloudflare.Healthcheck("http_health_check", new()
{
ZoneId = cloudflareZoneId,
Name = "http-health-check",
Description = "example http health check",
Address = "example.com",
Suspended = false,
CheckRegions = new[]
{
"WEU",
"EEU",
},
Type = "HTTPS",
Port = 443,
Method = "GET",
Path = "/health",
ExpectedBody = "alive",
ExpectedCodes = new[]
{
"2xx",
"301",
},
FollowRedirects = true,
AllowInsecure = false,
Headers = new[]
{
new Cloudflare.Inputs.HealthcheckHeaderArgs
{
Header = "Host",
Values = new[]
{
"example.com",
},
},
},
Timeout = 10,
Retries = 2,
Interval = 60,
ConsecutiveFails = 3,
ConsecutiveSuccesses = 2,
});
// TCP Healthcheck
var tcpHealthCheck = new Cloudflare.Healthcheck("tcp_health_check", new()
{
ZoneId = cloudflareZoneId,
Name = "tcp-health-check",
Description = "example tcp health check",
Address = "example.com",
Suspended = false,
CheckRegions = new[]
{
"WEU",
"EEU",
},
Type = "TCP",
Port = 22,
Method = "connection_established",
Timeout = 10,
Retries = 2,
Interval = 60,
ConsecutiveFails = 3,
ConsecutiveSuccesses = 2,
});
});
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// HTTPS Healthcheck
_, err := cloudflare.NewHealthcheck(ctx, "http_health_check", &cloudflare.HealthcheckArgs{
ZoneId: pulumi.Any(cloudflareZoneId),
Name: pulumi.String("http-health-check"),
Description: pulumi.String("example http health check"),
Address: pulumi.String("example.com"),
Suspended: pulumi.Bool(false),
CheckRegions: pulumi.StringArray{
pulumi.String("WEU"),
pulumi.String("EEU"),
},
Type: pulumi.String("HTTPS"),
Port: pulumi.Int(443),
Method: pulumi.String("GET"),
Path: pulumi.String("/health"),
ExpectedBody: pulumi.String("alive"),
ExpectedCodes: pulumi.StringArray{
pulumi.String("2xx"),
pulumi.String("301"),
},
FollowRedirects: pulumi.Bool(true),
AllowInsecure: pulumi.Bool(false),
Headers: cloudflare.HealthcheckHeaderArray{
&cloudflare.HealthcheckHeaderArgs{
Header: pulumi.String("Host"),
Values: pulumi.StringArray{
pulumi.String("example.com"),
},
},
},
Timeout: pulumi.Int(10),
Retries: pulumi.Int(2),
Interval: pulumi.Int(60),
ConsecutiveFails: pulumi.Int(3),
ConsecutiveSuccesses: pulumi.Int(2),
})
if err != nil {
return err
}
// TCP Healthcheck
_, err = cloudflare.NewHealthcheck(ctx, "tcp_health_check", &cloudflare.HealthcheckArgs{
ZoneId: pulumi.Any(cloudflareZoneId),
Name: pulumi.String("tcp-health-check"),
Description: pulumi.String("example tcp health check"),
Address: pulumi.String("example.com"),
Suspended: pulumi.Bool(false),
CheckRegions: pulumi.StringArray{
pulumi.String("WEU"),
pulumi.String("EEU"),
},
Type: pulumi.String("TCP"),
Port: pulumi.Int(22),
Method: pulumi.String("connection_established"),
Timeout: pulumi.Int(10),
Retries: pulumi.Int(2),
Interval: pulumi.Int(60),
ConsecutiveFails: pulumi.Int(3),
ConsecutiveSuccesses: pulumi.Int(2),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.Healthcheck;
import com.pulumi.cloudflare.HealthcheckArgs;
import com.pulumi.cloudflare.inputs.HealthcheckHeaderArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// HTTPS Healthcheck
var httpHealthCheck = new Healthcheck("httpHealthCheck", HealthcheckArgs.builder()
.zoneId(cloudflareZoneId)
.name("http-health-check")
.description("example http health check")
.address("example.com")
.suspended(false)
.checkRegions(
"WEU",
"EEU")
.type("HTTPS")
.port(443)
.method("GET")
.path("/health")
.expectedBody("alive")
.expectedCodes(
"2xx",
"301")
.followRedirects(true)
.allowInsecure(false)
.headers(HealthcheckHeaderArgs.builder()
.header("Host")
.values("example.com")
.build())
.timeout(10)
.retries(2)
.interval(60)
.consecutiveFails(3)
.consecutiveSuccesses(2)
.build());
// TCP Healthcheck
var tcpHealthCheck = new Healthcheck("tcpHealthCheck", HealthcheckArgs.builder()
.zoneId(cloudflareZoneId)
.name("tcp-health-check")
.description("example tcp health check")
.address("example.com")
.suspended(false)
.checkRegions(
"WEU",
"EEU")
.type("TCP")
.port(22)
.method("connection_established")
.timeout(10)
.retries(2)
.interval(60)
.consecutiveFails(3)
.consecutiveSuccesses(2)
.build());
}
}
resources:
# HTTPS Healthcheck
httpHealthCheck:
type: cloudflare:Healthcheck
name: http_health_check
properties:
zoneId: ${cloudflareZoneId}
name: http-health-check
description: example http health check
address: example.com
suspended: false
checkRegions:
- WEU
- EEU
type: HTTPS
port: 443
method: GET
path: /health
expectedBody: alive
expectedCodes:
- 2xx
- '301'
followRedirects: true
allowInsecure: false
headers:
- header: Host
values:
- example.com
timeout: 10
retries: 2
interval: 60
consecutiveFails: 3
consecutiveSuccesses: 2
# TCP Healthcheck
tcpHealthCheck:
type: cloudflare:Healthcheck
name: tcp_health_check
properties:
zoneId: ${cloudflareZoneId}
name: tcp-health-check
description: example tcp health check
address: example.com
suspended: false
checkRegions:
- WEU
- EEU
type: TCP
port: 22
method: connection_established
timeout: 10
retries: 2
interval: 60
consecutiveFails: 3
consecutiveSuccesses: 2

Import

Use the Zone ID and Healthcheck ID to import.

$ pulumi import cloudflare:index/healthcheck:Healthcheck example <zone_id>/<healthcheck_id>

Constructors

Link copied to clipboard
constructor(address: Output<String>? = null, allowInsecure: Output<Boolean>? = null, checkRegions: Output<List<String>>? = null, consecutiveFails: Output<Int>? = null, consecutiveSuccesses: Output<Int>? = null, description: Output<String>? = null, expectedBody: Output<String>? = null, expectedCodes: Output<List<String>>? = null, followRedirects: Output<Boolean>? = null, headers: Output<List<HealthcheckHeaderArgs>>? = null, interval: Output<Int>? = null, method: Output<String>? = null, name: Output<String>? = null, path: Output<String>? = null, port: Output<Int>? = null, retries: Output<Int>? = null, suspended: Output<Boolean>? = null, timeout: Output<Int>? = null, type: Output<String>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard
val address: Output<String>? = null

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

Link copied to clipboard
val allowInsecure: Output<Boolean>? = null

Do not validate the certificate when the health check uses HTTPS. Defaults to false.

Link copied to clipboard
val checkRegions: Output<List<String>>? = null

A list of regions from which to run health checks. If not set, Cloudflare will pick a default region. Available values: WNAM, ENAM, WEU, EEU, NSAM, SSAM, OC, ME, NAF, SAF, IN, SEAS, NEAS, ALL_REGIONS.

Link copied to clipboard
val consecutiveFails: Output<Int>? = null

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

Link copied to clipboard
val consecutiveSuccesses: Output<Int>? = null

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

Link copied to clipboard
val description: Output<String>? = null

A human-readable description of the health check.

Link copied to clipboard
val expectedBody: Output<String>? = null

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.

Link copied to clipboard
val expectedCodes: Output<List<String>>? = null

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

Link copied to clipboard
val followRedirects: Output<Boolean>? = null

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

Link copied to clipboard
val headers: Output<List<HealthcheckHeaderArgs>>? = null

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.

Link copied to clipboard
val interval: Output<Int>? = null

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

Link copied to clipboard
val method: Output<String>? = null

The HTTP method to use for the health check. Available values: connection_established, GET, HEAD.

Link copied to clipboard
val name: Output<String>? = null

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

Link copied to clipboard
val path: Output<String>? = null

The endpoint path to health check against. Defaults to /.

Link copied to clipboard
val port: Output<Int>? = null

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

Link copied to clipboard
val retries: Output<Int>? = null

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

Link copied to clipboard
val suspended: Output<Boolean>? = null

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

Link copied to clipboard
val timeout: Output<Int>? = null

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

Link copied to clipboard
val type: Output<String>? = null

The protocol to use for the health check. Available values: TCP, HTTP, HTTPS.

Link copied to clipboard
val zoneId: Output<String>? = null

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

Functions

Link copied to clipboard
open override fun toJava(): HealthcheckArgs