Healthcheck

class Healthcheck : KotlinCustomResource

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

Example Usage

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) {
var httpHealthCheck = new Healthcheck("httpHealthCheck", HealthcheckArgs.builder()
.zoneId(var_.cloudflare_zone_id())
.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());
var tcpHealthCheck = new Healthcheck("tcpHealthCheck", HealthcheckArgs.builder()
.zoneId(var_.cloudflare_zone_id())
.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());
}
}

Import

Use the Zone ID and Healthcheck ID to import.

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

Properties

Link copied to clipboard
val address: Output<String>

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

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

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

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

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>?

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

Link copied to clipboard

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

Link copied to clipboard
val createdOn: Output<String>

Creation time.

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

A human-readable description of the health check.

Link copied to clipboard
val expectedBody: Output<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.

Link copied to clipboard
val expectedCodes: Output<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.

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

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

Link copied to clipboard

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 id: Output<String>
Link copied to clipboard
val interval: Output<Int>?

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>

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

Link copied to clipboard
val modifiedOn: Output<String>

Last modified time.

Link copied to clipboard
val name: Output<String>

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

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

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

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

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val retries: Output<Int>?

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>?

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

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

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

Link copied to clipboard
val type: Output<String>

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

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val zoneId: Output<String>

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