Provides a Cloudflare Load Balancer resource. This sits in front of a number of defined pools of origins and provides various options for geographically-aware load balancing. Note that the load balancing feature must be enabled in your Clouflare account before you can use this resource.
# Define a load balancer which always points to a pool we define below
# In normal usage, would have different pools set for different pops (cloudflare points-of-presence) and/or for different regions
# Within each pop or region we can define multiple pools in failover order
resource "cloudflare_load_balancer" "bar" {
zone = "example.com"
name = "example-load-balancer"
fallback_pool_id = "${cloudflare_load_balancer_pool.foo.id}"
default_pool_ids = ["${cloudflare_load_balancer_pool.foo.id}"]
description = "example load balancer using geo-balancing"
proxied = true
pop_pools {
pop = "LAX"
pool_ids = ["${cloudflare_load_balancer_pool.foo.id}"]
}
region_pools {
region = "WNAM"
pool_ids = ["${cloudflare_load_balancer_pool.foo.id}"]
}
}
resource "cloudflare_load_balancer_pool" "foo" {
name = "example-lb-pool"
origins {
name = "example-1"
address = "192.0.2.1"
enabled = false
}
}
The following arguments are supported:
zone - (Required) The zone to add the load balancer to. name - (Required) The DNS name to associate with the load balancer. fallback_pool_id - (Required) The pool ID to use when all other pools are detected as unhealthy. default_pool_ids - (Required) A list of pool IDs ordered by their failover priority. Used whenever region/pop pools are not defined. description - (Optional) Free text description. ttl - (Optional) Time to live (TTL) of this load balancer's DNS name. Conflicts with proxied - this cannot be set for proxied load balancers. Default is 30. proxied - (Optional) Whether the hostname gets Cloudflare's origin protection. Defaults to false. region_pools - (Optional) A set containing mappings of region/country codes to a list of pool IDs (ordered by their failover priority) for the given region. Fields documented below. pop_pools - (Optional) A set containing mappings of Cloudflare Point-of-Presence (PoP) identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). This feature is only available to enterprise customers. Fields documented below. region_pools requires the following:
region - (Required) A region code which must be in the list defined here. Multiple entries should not be specified with the same region. pool_ids - (Required) A list of pool IDs in failover priority to use in the given region. pop_pools requires the following:
pop - (Required) A 3-letter code for the Point-of-Presence. Allowed values can be found in the list of datacenters on the status page. Multiple entries should not be specified with the same PoP. pool_ids - (Required) A list of pool IDs in failover priority to use for traffic reaching the given PoP. The following attributes are exported:
id - Unique identifier in the API for the load balancer. zone_id - ID associated with the specified zone. created_on - The RFC3339 timestamp of when the load balancer was created. modified_on - The RFC3339 timestamp of when the load balancer was last modified.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/cloudflare/r/load_balancer.html