Healthcheck Args
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>
Constructors
Properties
Do not validate the certificate when the health check uses HTTPS. Defaults to false
.
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
.
The number of consecutive fails required from a health check before changing the health to unhealthy. Defaults to 1
.
The number of consecutive successes required from a health check before changing the health to healthy. Defaults to 1
.
A human-readable description of the health check.
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.
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 if the origin returns a 3xx status code. Defaults to false
.
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.