LoadBalancerMonitor
If you’re using Cloudflare’s Load Balancing to load-balance across multiple origin servers or data centers, you configure one of these Monitors to actively check the availability of those servers over HTTP(S) or TCP.
Example Usage
HTTP Monitor
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
class MyStack : Stack
{
public MyStack()
{
var httpMonitor = new Cloudflare.LoadBalancerMonitor("httpMonitor", new Cloudflare.LoadBalancerMonitorArgs
{
AllowInsecure = false,
Description = "example http load balancer",
ExpectedBody = "alive",
ExpectedCodes = "2xx",
FollowRedirects = true,
Headers =
{
new Cloudflare.Inputs.LoadBalancerMonitorHeaderArgs
{
Header = "Host",
Values =
{
"example.com",
},
},
},
Interval = 60,
Method = "GET",
Path = "/health",
Retries = 5,
Timeout = 7,
Type = "http",
});
}
}
Coming soon!
import pulumi
import pulumi_cloudflare as cloudflare
http_monitor = cloudflare.LoadBalancerMonitor("httpMonitor",
allow_insecure=False,
description="example http load balancer",
expected_body="alive",
expected_codes="2xx",
follow_redirects=True,
headers=[{
"header": "Host",
"values": ["example.com"],
}],
interval=60,
method="GET",
path="/health",
retries=5,
timeout=7,
type="http")import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const httpMonitor = new cloudflare.LoadBalancerMonitor("http_monitor", {
allowInsecure: false,
description: "example http load balancer",
expectedBody: "alive",
expectedCodes: "2xx",
followRedirects: true,
headers: [{
header: "Host",
values: ["example.com"],
}],
interval: 60,
method: "GET",
path: "/health",
retries: 5,
timeout: 7,
type: "http",
});TCP Monitor
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
class MyStack : Stack
{
public MyStack()
{
var tcpMonitor = new Cloudflare.LoadBalancerMonitor("tcpMonitor", new Cloudflare.LoadBalancerMonitorArgs
{
Description = "example tcp load balancer",
Interval = 60,
Method = "connection_established",
Retries = 5,
Timeout = 7,
Type = "tcp",
});
}
}
Coming soon!
import pulumi
import pulumi_cloudflare as cloudflare
tcp_monitor = cloudflare.LoadBalancerMonitor("tcpMonitor",
description="example tcp load balancer",
interval=60,
method="connection_established",
retries=5,
timeout=7,
type="tcp")import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const tcpMonitor = new cloudflare.LoadBalancerMonitor("tcp_monitor", {
description: "example tcp load balancer",
interval: 60,
method: "connection_established",
retries: 5,
timeout: 7,
type: "tcp",
});Create a LoadBalancerMonitor Resource
new LoadBalancerMonitor(name: string, args?: LoadBalancerMonitorArgs, opts?: CustomResourceOptions);def LoadBalancerMonitor(resource_name, opts=None, allow_insecure=None, description=None, expected_body=None, expected_codes=None, follow_redirects=None, headers=None, interval=None, method=None, path=None, port=None, retries=None, timeout=None, type=None, __props__=None);func NewLoadBalancerMonitor(ctx *Context, name string, args *LoadBalancerMonitorArgs, opts ...ResourceOption) (*LoadBalancerMonitor, error)public LoadBalancerMonitor(string name, LoadBalancerMonitorArgs? args = null, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args LoadBalancerMonitorArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args LoadBalancerMonitorArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LoadBalancerMonitorArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
LoadBalancerMonitor Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The LoadBalancerMonitor resource accepts the following input properties:
- Allow
Insecure bool Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- Description string
Free text description.
- 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. Only valid if
typeis “http” or “https”. Default: “”.- Expected
Codes string The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- Follow
Redirects bool Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- Headers
List<Load
Balancer Monitor Header Args> The header name.
- Interval int
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- Method string
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- Path string
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- Port int
- Retries int
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- Timeout int
The timeout (in seconds) before marking the health check as failed. Default: 5.
- Type string
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
- Allow
Insecure bool Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- Description string
Free text description.
- 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. Only valid if
typeis “http” or “https”. Default: “”.- Expected
Codes string The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- Follow
Redirects bool Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- Headers
[]Load
Balancer Monitor Header The header name.
- Interval int
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- Method string
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- Path string
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- Port int
- Retries int
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- Timeout int
The timeout (in seconds) before marking the health check as failed. Default: 5.
- Type string
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
- allow
Insecure boolean Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- description string
Free text description.
- 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. Only valid if
typeis “http” or “https”. Default: “”.- expected
Codes string The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- follow
Redirects boolean Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- headers
Load
Balancer Monitor Header[] The header name.
- interval number
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- method string
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- path string
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- port number
- retries number
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- timeout number
The timeout (in seconds) before marking the health check as failed. Default: 5.
- type string
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
- allow_
insecure bool Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- description str
Free text description.
- expected_
body str 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. Only valid if
typeis “http” or “https”. Default: “”.- expected_
codes str The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- follow_
redirects bool Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- headers
List[Load
Balancer Monitor Header] The header name.
- interval float
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- method str
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- path str
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- port float
- retries float
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- timeout float
The timeout (in seconds) before marking the health check as failed. Default: 5.
- type str
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
Outputs
All input properties are implicitly available as output properties. Additionally, the LoadBalancerMonitor resource produces the following output properties:
- created_
on str The RFC3339 timestamp of when the load balancer monitor was created.
- id str
- The provider-assigned unique ID for this managed resource.
- modified_
on str The RFC3339 timestamp of when the load balancer monitor was last modified.
Look up an Existing LoadBalancerMonitor Resource
Get an existing LoadBalancerMonitor resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: LoadBalancerMonitorState, opts?: CustomResourceOptions): LoadBalancerMonitorstatic get(resource_name, id, opts=None, allow_insecure=None, created_on=None, description=None, expected_body=None, expected_codes=None, follow_redirects=None, headers=None, interval=None, method=None, modified_on=None, path=None, port=None, retries=None, timeout=None, type=None, __props__=None);func GetLoadBalancerMonitor(ctx *Context, name string, id IDInput, state *LoadBalancerMonitorState, opts ...ResourceOption) (*LoadBalancerMonitor, error)public static LoadBalancerMonitor Get(string name, Input<string> id, LoadBalancerMonitorState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Allow
Insecure bool Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- Created
On string The RFC3339 timestamp of when the load balancer monitor was created.
- Description string
Free text description.
- 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. Only valid if
typeis “http” or “https”. Default: “”.- Expected
Codes string The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- Follow
Redirects bool Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- Headers
List<Load
Balancer Monitor Header Args> The header name.
- Interval int
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- Method string
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- Modified
On string The RFC3339 timestamp of when the load balancer monitor was last modified.
- Path string
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- Port int
- Retries int
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- Timeout int
The timeout (in seconds) before marking the health check as failed. Default: 5.
- Type string
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
- Allow
Insecure bool Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- Created
On string The RFC3339 timestamp of when the load balancer monitor was created.
- Description string
Free text description.
- 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. Only valid if
typeis “http” or “https”. Default: “”.- Expected
Codes string The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- Follow
Redirects bool Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- Headers
[]Load
Balancer Monitor Header The header name.
- Interval int
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- Method string
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- Modified
On string The RFC3339 timestamp of when the load balancer monitor was last modified.
- Path string
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- Port int
- Retries int
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- Timeout int
The timeout (in seconds) before marking the health check as failed. Default: 5.
- Type string
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
- allow
Insecure boolean Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- created
On string The RFC3339 timestamp of when the load balancer monitor was created.
- description string
Free text description.
- 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. Only valid if
typeis “http” or “https”. Default: “”.- expected
Codes string The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- follow
Redirects boolean Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- headers
Load
Balancer Monitor Header[] The header name.
- interval number
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- method string
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- modified
On string The RFC3339 timestamp of when the load balancer monitor was last modified.
- path string
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- port number
- retries number
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- timeout number
The timeout (in seconds) before marking the health check as failed. Default: 5.
- type string
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
- allow_
insecure bool Do not validate the certificate when monitor use HTTPS. Only valid if
typeis “http” or “https”.- created_
on str The RFC3339 timestamp of when the load balancer monitor was created.
- description str
Free text description.
- expected_
body str 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. Only valid if
typeis “http” or “https”. Default: “”.- expected_
codes str The expected HTTP response code or code range of the health check. Eg
2xx. Only valid and required iftypeis “http” or “https”.- follow_
redirects bool Follow redirects if returned by the origin. Only valid if
typeis “http” or “https”.- headers
List[Load
Balancer Monitor Header] The header name.
- interval float
The interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations. Default: 60.
- method str
The method to use for the health check. Valid values are any valid HTTP verb if
typeis “http” or “https”, orconnection_establishediftypeis “tcp”. Default: “GET” iftypeis “http” or “https”, or “connection_established” iftypeis “tcp” .- modified_
on str The RFC3339 timestamp of when the load balancer monitor was last modified.
- path str
The endpoint path to health check against. Default: “/”. Only valid if
typeis “http” or “https”.- port float
- retries float
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately. Default: 2.
- timeout float
The timeout (in seconds) before marking the health check as failed. Default: 5.
- type str
The protocol to use for the healthcheck. Currently supported protocols are ‘HTTP’, ‘HTTPS’ and ‘TCP’. Default: “http”.
Supporting Types
LoadBalancerMonitorHeader
- Header string
The header name.
- Values List<string>
A list of string values for the header.
Package Details
- Repository
- https://github.com/pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflareTerraform Provider.