Skip to content
Start here

Load Balancers

resource cloudflare_load_balancer

required Expand Collapse
zone_id: String
fallback_pool: String

The pool ID to use when all other pools are detected as unhealthy.

name: String

The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.

default_pools: List[String]

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

optional Expand Collapse
description?: String

Object description.

session_affinity_ttl?: Float64

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

ttl?: Float64

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

country_pools?: Map[List[String]]

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

networks?: List[String]

List of networks where Load Balancer or Pool is enabled.

pop_pools?: Map[List[String]]

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

region_pools?: Map[List[String]]

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

enabled?: Bool

Whether to enable (the default) this load balancer.

proxied?: Bool

Whether the hostname should be gray clouded (false) or orange clouded (true).

session_affinity?: String

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

steering_policy?: String

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
adaptive_routing?: Attributes

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

failover_across_pools?: Bool

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

location_strategy?: Attributes

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

mode?: String

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
prefer_ecs?: String

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
random_steering?: Attributes

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
default_weight?: Float64

The default weight for pools in the load balancer that are not specified in the pool_weights map.

pool_weights?: Map[Float64]

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

rules?: List[Attributes]

BETA Field Not General Access: A list of rules for this load balancer to execute.

condition?: String

The condition expressions to evaluate. If the condition evaluates to true, the overrides or fixed_response in this rule will be applied. An empty condition is always true. For more details on condition expressions, please see https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions.

disabled?: Bool

Disable this specific rule. It will no longer be evaluated by this load balancer.

fixed_response?: Attributes

A collection of fields used to directly respond to the eyeball instead of routing to a pool. If a fixed_response is supplied the rule will be marked as terminates.

content_type?: String

The http 'Content-Type' header to include in the response.

location?: String

The http 'Location' header to include in the response.

message_body?: String

Text to include as the http body.

status_code?: Int64

The http status code to respond with.

name?: String

Name of this rule. Only used for human readability.

overrides?: Attributes

A collection of overrides to apply to the load balancer when this rule's condition is true. All fields are optional.

adaptive_routing?: Attributes

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

failover_across_pools?: Bool

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

country_pools?: Map[List[String]]

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

default_pools?: List[String]

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

fallback_pool?: String

The pool ID to use when all other pools are detected as unhealthy.

location_strategy?: Attributes

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

mode?: String

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
prefer_ecs?: String

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
pop_pools?: Map[List[String]]

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

random_steering?: Attributes

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
default_weight?: Float64

The default weight for pools in the load balancer that are not specified in the pool_weights map.

pool_weights?: Map[Float64]

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

region_pools?: Map[List[String]]

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

session_affinity?: String

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

session_affinity_attributes?: Attributes

Configures attributes for session affinity.

drain_duration?: Float64

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

headers?: List[String]

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

require_all_headers?: Bool

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

samesite?: String

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

secure?: String

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

zero_downtime_failover?: String

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

session_affinity_ttl?: Float64

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

steering_policy?: String

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
ttl?: Float64

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

priority?: Int64

The order in which rules should be executed in relation to each other. Lower values are executed first. Values do not need to be sequential. If no value is provided for any rule the array order of the rules field will be used to assign a priority.

terminates?: Bool

If this rule's condition is true, this causes rule evaluation to stop after processing this rule.

session_affinity_attributes?: Attributes

Configures attributes for session affinity.

drain_duration?: Float64

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

headers?: List[String]

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

require_all_headers?: Bool

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

samesite?: String

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

secure?: String

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

zero_downtime_failover?: String

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

computed Expand Collapse
id: String
created_on: String
modified_on: String
zone_name: String

cloudflare_load_balancer

resource "cloudflare_load_balancer" "example_load_balancer" {
  zone_id = "699d98642c564d2e855e9661899b7252"
  default_pools = ["17b5962d775c646f3f9725cbc7a53df4", "9290f38c5d07c2e2f4df57b1f61d4196", "00920f38ce07c2e2f4df50b1f61d4194"]
  fallback_pool = "fallback_pool"
  name = "www.example.com"
  adaptive_routing = {
    failover_across_pools = true
  }
  country_pools = {
    GB = ["abd90f38ced07c2e2f4df50b1f61d4194"]
    US = ["de90f38ced07c2e2f4df50b1f61d4194", "00920f38ce07c2e2f4df50b1f61d4194"]
  }
  description = "Load Balancer for www.example.com"
  location_strategy = {
    mode = "resolver_ip"
    prefer_ecs = "always"
  }
  networks = ["string"]
  pop_pools = {
    LAX = ["de90f38ced07c2e2f4df50b1f61d4194", "9290f38c5d07c2e2f4df57b1f61d4196"]
    LHR = ["abd90f38ced07c2e2f4df50b1f61d4194", "f9138c5d07c2e2f4df57b1f61d4196"]
    SJC = ["00920f38ce07c2e2f4df50b1f61d4194"]
  }
  proxied = true
  random_steering = {
    default_weight = 0.2
    pool_weights = {
      "9290f38c5d07c2e2f4df57b1f61d4196" = 0.5
      de90f38ced07c2e2f4df50b1f61d4194 = 0.3
    }
  }
  region_pools = {
    ENAM = ["00920f38ce07c2e2f4df50b1f61d4194"]
    WNAM = ["de90f38ced07c2e2f4df50b1f61d4194", "9290f38c5d07c2e2f4df57b1f61d4196"]
  }
  rules = [{
    condition = "http.request.uri.path contains \"/testing\""
    disabled = true
    fixed_response = {
      content_type = "application/json"
      location = "www.example.com"
      message_body = "Testing Hello"
      status_code = 0
    }
    name = "route the path /testing to testing datacenter."
    overrides = {
      adaptive_routing = {
        failover_across_pools = true
      }
      country_pools = {
        GB = ["abd90f38ced07c2e2f4df50b1f61d4194"]
        US = ["de90f38ced07c2e2f4df50b1f61d4194", "00920f38ce07c2e2f4df50b1f61d4194"]
      }
      default_pools = ["17b5962d775c646f3f9725cbc7a53df4", "9290f38c5d07c2e2f4df57b1f61d4196", "00920f38ce07c2e2f4df50b1f61d4194"]
      fallback_pool = "fallback_pool"
      location_strategy = {
        mode = "resolver_ip"
        prefer_ecs = "always"
      }
      pop_pools = {
        LAX = ["de90f38ced07c2e2f4df50b1f61d4194", "9290f38c5d07c2e2f4df57b1f61d4196"]
        LHR = ["abd90f38ced07c2e2f4df50b1f61d4194", "f9138c5d07c2e2f4df57b1f61d4196"]
        SJC = ["00920f38ce07c2e2f4df50b1f61d4194"]
      }
      random_steering = {
        default_weight = 0.2
        pool_weights = {
          "9290f38c5d07c2e2f4df57b1f61d4196" = 0.5
          de90f38ced07c2e2f4df50b1f61d4194 = 0.3
        }
      }
      region_pools = {
        ENAM = ["00920f38ce07c2e2f4df50b1f61d4194"]
        WNAM = ["de90f38ced07c2e2f4df50b1f61d4194", "9290f38c5d07c2e2f4df57b1f61d4196"]
      }
      session_affinity = "cookie"
      session_affinity_attributes = {
        drain_duration = 100
        headers = ["x"]
        require_all_headers = true
        samesite = "Auto"
        secure = "Auto"
        zero_downtime_failover = "sticky"
      }
      session_affinity_ttl = 1800
      steering_policy = "dynamic_latency"
      ttl = 30
    }
    priority = 0
    terminates = true
  }]
  session_affinity = "cookie"
  session_affinity_attributes = {
    drain_duration = 100
    headers = ["x"]
    require_all_headers = true
    samesite = "Auto"
    secure = "Auto"
    zero_downtime_failover = "sticky"
  }
  session_affinity_ttl = 1800
  steering_policy = "dynamic_latency"
  ttl = 30
}

data cloudflare_load_balancer

required Expand Collapse
load_balancer_id: String
zone_id: String
computed Expand Collapse
id: String
created_on: String
description: String

Object description.

enabled: Bool

Whether to enable (the default) this load balancer.

fallback_pool: String

The pool ID to use when all other pools are detected as unhealthy.

modified_on: String
name: String

The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.

proxied: Bool

Whether the hostname should be gray clouded (false) or orange clouded (true).

session_affinity: String

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

session_affinity_ttl: Float64

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

steering_policy: String

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
ttl: Float64

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

zone_name: String
country_pools: Map[List[String]]

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

default_pools: List[String]

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

networks: List[String]

List of networks where Load Balancer or Pool is enabled.

pop_pools: Map[List[String]]

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

region_pools: Map[List[String]]

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

adaptive_routing: Attributes

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

failover_across_pools: Bool

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

location_strategy: Attributes

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

mode: String

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
prefer_ecs: String

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
random_steering: Attributes

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
default_weight: Float64

The default weight for pools in the load balancer that are not specified in the pool_weights map.

pool_weights: Map[Float64]

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

rules: List[Attributes]

BETA Field Not General Access: A list of rules for this load balancer to execute.

condition: String

The condition expressions to evaluate. If the condition evaluates to true, the overrides or fixed_response in this rule will be applied. An empty condition is always true. For more details on condition expressions, please see https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions.

disabled: Bool

Disable this specific rule. It will no longer be evaluated by this load balancer.

fixed_response: Attributes

A collection of fields used to directly respond to the eyeball instead of routing to a pool. If a fixed_response is supplied the rule will be marked as terminates.

content_type: String

The http 'Content-Type' header to include in the response.

location: String

The http 'Location' header to include in the response.

message_body: String

Text to include as the http body.

status_code: Int64

The http status code to respond with.

name: String

Name of this rule. Only used for human readability.

overrides: Attributes

A collection of overrides to apply to the load balancer when this rule's condition is true. All fields are optional.

adaptive_routing: Attributes

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

failover_across_pools: Bool

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

country_pools: Map[List[String]]

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

default_pools: List[String]

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

fallback_pool: String

The pool ID to use when all other pools are detected as unhealthy.

location_strategy: Attributes

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

mode: String

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
prefer_ecs: String

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
pop_pools: Map[List[String]]

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

random_steering: Attributes

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
default_weight: Float64

The default weight for pools in the load balancer that are not specified in the pool_weights map.

pool_weights: Map[Float64]

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

region_pools: Map[List[String]]

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

session_affinity: String

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

session_affinity_attributes: Attributes

Configures attributes for session affinity.

drain_duration: Float64

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

headers: List[String]

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

require_all_headers: Bool

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

samesite: String

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

secure: String

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

zero_downtime_failover: String

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

session_affinity_ttl: Float64

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

steering_policy: String

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
ttl: Float64

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

priority: Int64

The order in which rules should be executed in relation to each other. Lower values are executed first. Values do not need to be sequential. If no value is provided for any rule the array order of the rules field will be used to assign a priority.

terminates: Bool

If this rule's condition is true, this causes rule evaluation to stop after processing this rule.

session_affinity_attributes: Attributes

Configures attributes for session affinity.

drain_duration: Float64

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

headers: List[String]

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

require_all_headers: Bool

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

samesite: String

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

secure: String

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

zero_downtime_failover: String

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

cloudflare_load_balancer

data "cloudflare_load_balancer" "example_load_balancer" {
  zone_id = "699d98642c564d2e855e9661899b7252"
  load_balancer_id = "699d98642c564d2e855e9661899b7252"
}

data cloudflare_load_balancers

required Expand Collapse
zone_id: String
optional Expand Collapse
max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String
adaptive_routing: Attributes

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

failover_across_pools: Bool

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

country_pools: Map[List[String]]

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

created_on: String
default_pools: List[String]

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

description: String

Object description.

enabled: Bool

Whether to enable (the default) this load balancer.

fallback_pool: String

The pool ID to use when all other pools are detected as unhealthy.

location_strategy: Attributes

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

mode: String

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
prefer_ecs: String

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
modified_on: String
name: String

The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used.

networks: List[String]

List of networks where Load Balancer or Pool is enabled.

pop_pools: Map[List[String]]

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

proxied: Bool

Whether the hostname should be gray clouded (false) or orange clouded (true).

random_steering: Attributes

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
default_weight: Float64

The default weight for pools in the load balancer that are not specified in the pool_weights map.

pool_weights: Map[Float64]

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

region_pools: Map[List[String]]

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

rules: List[Attributes]

BETA Field Not General Access: A list of rules for this load balancer to execute.

condition: String

The condition expressions to evaluate. If the condition evaluates to true, the overrides or fixed_response in this rule will be applied. An empty condition is always true. For more details on condition expressions, please see https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions.

disabled: Bool

Disable this specific rule. It will no longer be evaluated by this load balancer.

fixed_response: Attributes

A collection of fields used to directly respond to the eyeball instead of routing to a pool. If a fixed_response is supplied the rule will be marked as terminates.

content_type: String

The http 'Content-Type' header to include in the response.

location: String

The http 'Location' header to include in the response.

message_body: String

Text to include as the http body.

status_code: Int64

The http status code to respond with.

name: String

Name of this rule. Only used for human readability.

overrides: Attributes

A collection of overrides to apply to the load balancer when this rule's condition is true. All fields are optional.

adaptive_routing: Attributes

Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin.

failover_across_pools: Bool

Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See session_affinity_attributes for control over when sessions are broken or reassigned.

country_pools: Map[List[String]]

A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools.

default_pools: List[String]

A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region.

fallback_pool: String

The pool ID to use when all other pools are detected as unhealthy.

location_strategy: Attributes

Controls location-based steering for non-proxied requests. See steering_policy to learn how steering is affected.

mode: String

Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.

  • "pop": Use the Cloudflare PoP location.
  • "resolver_ip": Use the DNS resolver GeoIP location. If the GeoIP lookup is unsuccessful, use the Cloudflare PoP location.
prefer_ecs: String

Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.

  • "always": Always prefer ECS.
  • "never": Never prefer ECS.
  • "proximity": Prefer ECS only when steering_policy="proximity".
  • "geo": Prefer ECS only when steering_policy="geo".
pop_pools: Map[List[String]]

Enterprise only: A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools.

random_steering: Attributes

Configures pool weights.

  • steering_policy="random": A random pool is selected with probability proportional to pool weights.
  • steering_policy="least_outstanding_requests": Use pool weights to scale each pool's outstanding requests.
  • steering_policy="least_connections": Use pool weights to scale each pool's open connections.
default_weight: Float64

The default weight for pools in the load balancer that are not specified in the pool_weights map.

pool_weights: Map[Float64]

A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer.

region_pools: Map[List[String]]

A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools.

session_affinity: String

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

session_affinity_attributes: Attributes

Configures attributes for session affinity.

drain_duration: Float64

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

headers: List[String]

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

require_all_headers: Bool

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

samesite: String

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

secure: String

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

zero_downtime_failover: String

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

session_affinity_ttl: Float64

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

steering_policy: String

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
ttl: Float64

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

priority: Int64

The order in which rules should be executed in relation to each other. Lower values are executed first. Values do not need to be sequential. If no value is provided for any rule the array order of the rules field will be used to assign a priority.

terminates: Bool

If this rule's condition is true, this causes rule evaluation to stop after processing this rule.

session_affinity: String

Specifies the type of session affinity the load balancer should use unless specified as "none". The supported types are: - "cookie": On the first request to a proxied load balancer, a cookie is generated, encoding information of which origin the request will be forwarded to. Subsequent requests, by the same client to the same load balancer, will be sent to the origin server the cookie encodes, for the duration of the cookie and as long as the origin server remains healthy. If the cookie has expired or the origin server is unhealthy, then a new origin server is calculated and used. - "ip_cookie": Behaves the same as "cookie" except the initial origin selection is stable and based on the client's ip address. - "header": On the first request to a proxied load balancer, a session key based on the configured HTTP headers (see session_affinity_attributes.headers) is generated, encoding the request headers used for storing in the load balancer session state which origin the request will be forwarded to. Subsequent requests to the load balancer with the same headers will be sent to the same origin server, for the duration of the session and as long as the origin server remains healthy. If the session has been idle for the duration of session_affinity_ttl seconds or the origin server is unhealthy, then a new origin server is calculated and used. See headers in session_affinity_attributes for additional required configuration.

session_affinity_attributes: Attributes

Configures attributes for session affinity.

drain_duration: Float64

Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer.

headers: List[String]

Configures the names of HTTP headers to base session affinity on when header session_affinity is enabled. At least one HTTP header name must be provided. To specify the exact cookies to be used, include an item in the following format: "cookie:<cookie-name-1>,<cookie-name-2>" (example) where everything after the colon is a comma-separated list of cookie names. Providing only "cookie" will result in all cookies being used. The default max number of HTTP header names that can be provided depends on your plan: 5 for Enterprise, 1 for all other plans.

require_all_headers: Bool

When header session_affinity is enabled, this option can be used to specify how HTTP headers on load balancing requests will be used. The supported values are: - "true": Load balancing requests must contain all of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created. - "false": Load balancing requests must contain at least one of the HTTP headers specified by the headers session affinity attribute, otherwise sessions aren't created.

samesite: String

Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never".

secure: String

Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled.

zero_downtime_failover: String

Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are: - "none": No failover takes place for sessions pinned to the origin (default). - "temporary": Traffic will be sent to another other healthy origin until the originally pinned origin is available; note that this can potentially result in heavy origin flapping. - "sticky": The session affinity cookie is updated and subsequent requests are sent to the new origin. Note: Zero-downtime failover with sticky sessions is currently not supported for session affinity by header.

session_affinity_ttl: Float64

Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per session_affinity policy are: - "cookie" / "ip_cookie": The current default of 23 hours will be used unless explicitly set. The accepted range of values is between [1800, 604800]. - "header": The current default of 1800 seconds will be used unless explicitly set. The accepted range of values is between [30, 3600]. Note: With session affinity by header, sessions only expire after they haven't been used for the number of seconds specified.

steering_policy: String

Steering Policy for this load balancer.

  • "off": Use default_pools.
  • "geo": Use region_pools/country_pools/pop_pools. For non-proxied requests, the country for country_pools is determined by location_strategy.
  • "random": Select a pool randomly.
  • "dynamic_latency": Use round trip time to select the closest pool in default_pools (requires pool health checks).
  • "proximity": Use the pools' latitude and longitude to select the closest pool using the Cloudflare PoP location for proxied requests or the location determined by location_strategy for non-proxied requests.
  • "least_outstanding_requests": Select a pool by taking into consideration random_steering weights, as well as each pool's number of outstanding requests. Pools with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select a pool by taking into consideration random_steering weights, as well as each pool's number of open connections. Pools with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
  • "": Will map to "geo" if you use region_pools/country_pools/pop_pools otherwise "off".
ttl: Float64

Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers.

zone_name: String

cloudflare_load_balancers

data "cloudflare_load_balancers" "example_load_balancers" {
  zone_id = "699d98642c564d2e855e9661899b7252"
}

Load BalancersMonitors

resource cloudflare_load_balancer_monitor

required Expand Collapse
account_id: String

Identifier.

optional Expand Collapse
consecutive_down?: Int64

To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.

consecutive_up?: Int64

To be marked healthy the monitored origin must pass this healthcheck N consecutive times.

port?: Int64

The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).

header?: Map[List[String]]

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. This parameter is only valid for HTTP and HTTPS monitors.

allow_insecure?: Bool

Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.

description?: String

Object 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. This parameter is only valid for HTTP and HTTPS monitors.

expected_codes?: String

The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.

follow_redirects?: Bool

Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.

interval?: Int64

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.

method?: String

The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.

path?: String

The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.

probe_zone?: String

Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.

retries?: Int64

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

timeout?: Int64

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

type?: String

The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.

computed Expand Collapse
id: String
created_on: String
modified_on: String

cloudflare_load_balancer_monitor

resource "cloudflare_load_balancer_monitor" "example_load_balancer_monitor" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  allow_insecure = true
  consecutive_down = 0
  consecutive_up = 0
  description = "Login page monitor"
  expected_body = "alive"
  expected_codes = "2xx"
  follow_redirects = true
  header = {
    Host = ["example.com"]
    X-App-ID = ["abc123"]
  }
  interval = 0
  method = "GET"
  path = "/health"
  port = 0
  probe_zone = "example.com"
  retries = 0
  timeout = 0
  type = "https"
}

data cloudflare_load_balancer_monitor

required Expand Collapse
monitor_id: String
account_id: String

Identifier.

computed Expand Collapse
id: String
allow_insecure: Bool

Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.

consecutive_down: Int64

To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.

consecutive_up: Int64

To be marked healthy the monitored origin must pass this healthcheck N consecutive times.

created_on: String
description: String

Object 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. This parameter is only valid for HTTP and HTTPS monitors.

expected_codes: String

The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.

follow_redirects: Bool

Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.

interval: Int64

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.

method: String

The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.

modified_on: String
path: String

The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.

port: Int64

The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).

probe_zone: String

Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.

retries: Int64

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

timeout: Int64

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

type: String

The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.

header: Map[List[String]]

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. This parameter is only valid for HTTP and HTTPS monitors.

cloudflare_load_balancer_monitor

data "cloudflare_load_balancer_monitor" "example_load_balancer_monitor" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  monitor_id = "f1aba936b94213e5b8dca0c0dbf1f9cc"
}

data cloudflare_load_balancer_monitors

required Expand Collapse
account_id: String

Identifier.

optional Expand Collapse
max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String
allow_insecure: Bool

Do not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.

consecutive_down: Int64

To be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.

consecutive_up: Int64

To be marked healthy the monitored origin must pass this healthcheck N consecutive times.

created_on: String
description: String

Object 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. This parameter is only valid for HTTP and HTTPS monitors.

expected_codes: String

The expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors.

follow_redirects: Bool

Follow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.

header: Map[List[String]]

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. This parameter is only valid for HTTP and HTTPS monitors.

interval: Int64

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.

method: String

The method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks.

modified_on: String
path: String

The endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors.

port: Int64

The port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443).

probe_zone: String

Assign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors.

retries: Int64

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

timeout: Int64

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

type: String

The protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'.

cloudflare_load_balancer_monitors

data "cloudflare_load_balancer_monitors" "example_load_balancer_monitors" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
}

Load BalancersPools

resource cloudflare_load_balancer_pool

required Expand Collapse
account_id: String

Identifier.

name: String

A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.

origins: Set[Attributes]

The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy.

address?: String

The IP address (IPv4 or IPv6) of the origin, or its publicly addressable hostname. Hostnames entered here should resolve directly to the origin, and not be a hostname proxied by Cloudflare. To set an internal/reserved address, virtual_network_id must also be set.

disabled_at?: Time

This field shows up only if the origin is disabled. This field is set with the time the origin was disabled.

enabled?: Bool

Whether to enable (the default) this origin within the pool. Disabled origins will not receive traffic and are excluded from health checks. The origin will only be disabled for the current pool.

header?: Attributes

The request header is used to pass additional information with an HTTP request. Currently supported header is 'Host'.

host?: List[String]

The 'Host' header allows to override the hostname set in the HTTP request. Current support is 1 'Host' header override per origin.

name?: String

A human-identifiable name for the origin.

port?: Int64

The port for upstream connections. A value of 0 means the default port for the protocol will be used.

virtual_network_id?: String

The virtual network subnet ID the origin belongs in. Virtual network must also belong to the account.

weight?: Float64

The weight of this origin relative to other origins in the pool. Based on the configured weight the total traffic is distributed among origins within the pool.

  • origin_steering.policy="least_outstanding_requests": Use weight to scale the origin's outstanding requests.
  • origin_steering.policy="least_connections": Use weight to scale the origin's open connections.
optional Expand Collapse
latitude?: Float64

The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.

longitude?: Float64

The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.

monitor?: String

The ID of the Monitor to use for checking the health of origins within this pool.

monitor_group?: String

The ID of the Monitor Group to use for checking the health of origins within this pool.

check_regions?: List[String]

A list of regions from which to run health checks. Null means every Cloudflare data center.

load_shedding?: Attributes

Configures load shedding policies and percentages for the pool.

default_percent?: Float64

The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.

default_policy?: String

The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.

session_percent?: Float64

The percent of existing sessions to shed from the pool, according to the session policy.

session_policy?: String

Only the hash policy is supported for existing sessions (to avoid exponential decay).

notification_filter?: Attributes

Filter pool and origin health notifications by resource type or health status. Use null to reset.

origin?: Attributes

Filter options for a particular resource type (pool or origin). Use null to reset.

disable?: Bool

If set true, disable notifications for this type of resource (pool or origin).

healthy?: Bool

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

pool?: Attributes

Filter options for a particular resource type (pool or origin). Use null to reset.

disable?: Bool

If set true, disable notifications for this type of resource (pool or origin).

healthy?: Bool

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

origin_steering?: Attributes

Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity.

policy?: String

The type of origin steering policy to use.

  • "random": Select an origin randomly.
  • "hash": Select an origin by computing a hash over the CF-Connecting-IP address.
  • "least_outstanding_requests": Select an origin by taking into consideration origin weights, as well as each origin's number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select an origin by taking into consideration origin weights, as well as each origin's number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
description?: String

A human-readable description of the pool.

enabled?: Bool

Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).

minimum_origins?: Int64

The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.

notification_email?: String

This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.

computed Expand Collapse
id: String
created_on: String
disabled_at: Time

This field shows up only if the pool is disabled. This field is set with the time the pool was disabled at.

modified_on: String
networks: List[String]

List of networks where Load Balancer or Pool is enabled.

cloudflare_load_balancer_pool

resource "cloudflare_load_balancer_pool" "example_load_balancer_pool" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  name = "primary-dc-1"
  origins = [{
    address = "0.0.0.0"
    enabled = true
    header = {
      host = ["example.com"]
    }
    name = "app-server-1"
    port = 0
    virtual_network_id = "a5624d4e-044a-4ff0-b3e1-e2465353d4b4"
    weight = 0.6
  }]
  description = "Primary data center - Provider XYZ"
  enabled = false
  latitude = 0
  load_shedding = {
    default_percent = 0
    default_policy = "random"
    session_percent = 0
    session_policy = "hash"
  }
  longitude = 0
  minimum_origins = 0
  monitor = "monitor"
  monitor_group = "monitor_group"
  notification_email = "someone@example.com,sometwo@example.com"
  notification_filter = {
    origin = {
      disable = true
      healthy = true
    }
    pool = {
      disable = true
      healthy = false
    }
  }
  origin_steering = {
    policy = "random"
  }
}

data cloudflare_load_balancer_pool

required Expand Collapse
account_id: String

Identifier.

optional Expand Collapse
pool_id?: String
filter?: Attributes
monitor?: String

The ID of the Monitor to use for checking the health of origins within this pool.

computed Expand Collapse
id: String
created_on: String
description: String

A human-readable description of the pool.

disabled_at: Time

This field shows up only if the pool is disabled. This field is set with the time the pool was disabled at.

enabled: Bool

Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).

latitude: Float64

The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.

longitude: Float64

The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.

minimum_origins: Int64

The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.

modified_on: String
monitor: String

The ID of the Monitor to use for checking the health of origins within this pool.

monitor_group: String

The ID of the Monitor Group to use for checking the health of origins within this pool.

name: String

A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.

notification_email: String

This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.

check_regions: List[String]

A list of regions from which to run health checks. Null means every Cloudflare data center.

networks: List[String]

List of networks where Load Balancer or Pool is enabled.

load_shedding: Attributes

Configures load shedding policies and percentages for the pool.

default_percent: Float64

The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.

default_policy: String

The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.

session_percent: Float64

The percent of existing sessions to shed from the pool, according to the session policy.

session_policy: String

Only the hash policy is supported for existing sessions (to avoid exponential decay).

notification_filter: Attributes

Filter pool and origin health notifications by resource type or health status. Use null to reset.

origin: Attributes

Filter options for a particular resource type (pool or origin). Use null to reset.

disable: Bool

If set true, disable notifications for this type of resource (pool or origin).

healthy: Bool

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

pool: Attributes

Filter options for a particular resource type (pool or origin). Use null to reset.

disable: Bool

If set true, disable notifications for this type of resource (pool or origin).

healthy: Bool

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

origin_steering: Attributes

Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity.

policy: String

The type of origin steering policy to use.

  • "random": Select an origin randomly.
  • "hash": Select an origin by computing a hash over the CF-Connecting-IP address.
  • "least_outstanding_requests": Select an origin by taking into consideration origin weights, as well as each origin's number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select an origin by taking into consideration origin weights, as well as each origin's number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
origins: Set[Attributes]

The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy.

address: String

The IP address (IPv4 or IPv6) of the origin, or its publicly addressable hostname. Hostnames entered here should resolve directly to the origin, and not be a hostname proxied by Cloudflare. To set an internal/reserved address, virtual_network_id must also be set.

disabled_at: Time

This field shows up only if the origin is disabled. This field is set with the time the origin was disabled.

enabled: Bool

Whether to enable (the default) this origin within the pool. Disabled origins will not receive traffic and are excluded from health checks. The origin will only be disabled for the current pool.

header: Attributes

The request header is used to pass additional information with an HTTP request. Currently supported header is 'Host'.

host: List[String]

The 'Host' header allows to override the hostname set in the HTTP request. Current support is 1 'Host' header override per origin.

name: String

A human-identifiable name for the origin.

port: Int64

The port for upstream connections. A value of 0 means the default port for the protocol will be used.

virtual_network_id: String

The virtual network subnet ID the origin belongs in. Virtual network must also belong to the account.

weight: Float64

The weight of this origin relative to other origins in the pool. Based on the configured weight the total traffic is distributed among origins within the pool.

  • origin_steering.policy="least_outstanding_requests": Use weight to scale the origin's outstanding requests.
  • origin_steering.policy="least_connections": Use weight to scale the origin's open connections.

cloudflare_load_balancer_pool

data "cloudflare_load_balancer_pool" "example_load_balancer_pool" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  pool_id = "17b5962d775c646f3f9725cbc7a53df4"
}

data cloudflare_load_balancer_pools

required Expand Collapse
account_id: String

Identifier.

optional Expand Collapse
monitor?: String

The ID of the Monitor to use for checking the health of origins within this pool.

max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String
check_regions: List[String]

A list of regions from which to run health checks. Null means every Cloudflare data center.

created_on: String
description: String

A human-readable description of the pool.

disabled_at: Time

This field shows up only if the pool is disabled. This field is set with the time the pool was disabled at.

enabled: Bool

Whether to enable (the default) or disable this pool. Disabled pools will not receive traffic and are excluded from health checks. Disabling a pool will cause any load balancers using it to failover to the next pool (if any).

latitude: Float64

The latitude of the data center containing the origins used in this pool in decimal degrees. If this is set, longitude must also be set.

load_shedding: Attributes

Configures load shedding policies and percentages for the pool.

default_percent: Float64

The percent of traffic to shed from the pool, according to the default policy. Applies to new sessions and traffic without session affinity.

default_policy: String

The default policy to use when load shedding. A random policy randomly sheds a given percent of requests. A hash policy computes a hash over the CF-Connecting-IP address and sheds all requests originating from a percent of IPs.

session_percent: Float64

The percent of existing sessions to shed from the pool, according to the session policy.

session_policy: String

Only the hash policy is supported for existing sessions (to avoid exponential decay).

longitude: Float64

The longitude of the data center containing the origins used in this pool in decimal degrees. If this is set, latitude must also be set.

minimum_origins: Int64

The minimum number of origins that must be healthy for this pool to serve traffic. If the number of healthy origins falls below this number, the pool will be marked unhealthy and will failover to the next available pool.

modified_on: String
monitor: String

The ID of the Monitor to use for checking the health of origins within this pool.

monitor_group: String

The ID of the Monitor Group to use for checking the health of origins within this pool.

name: String

A short name (tag) for the pool. Only alphanumeric characters, hyphens, and underscores are allowed.

networks: List[String]

List of networks where Load Balancer or Pool is enabled.

notification_email: String

This field is now deprecated. It has been moved to Cloudflare's Centralized Notification service https://developers.cloudflare.com/fundamentals/notifications/. The email address to send health status notifications to. This can be an individual mailbox or a mailing list. Multiple emails can be supplied as a comma delimited list.

notification_filter: Attributes

Filter pool and origin health notifications by resource type or health status. Use null to reset.

origin: Attributes

Filter options for a particular resource type (pool or origin). Use null to reset.

disable: Bool

If set true, disable notifications for this type of resource (pool or origin).

healthy: Bool

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

pool: Attributes

Filter options for a particular resource type (pool or origin). Use null to reset.

disable: Bool

If set true, disable notifications for this type of resource (pool or origin).

healthy: Bool

If present, send notifications only for this health status (e.g. false for only DOWN events). Use null to reset (all events).

origin_steering: Attributes

Configures origin steering for the pool. Controls how origins are selected for new sessions and traffic without session affinity.

policy: String

The type of origin steering policy to use.

  • "random": Select an origin randomly.
  • "hash": Select an origin by computing a hash over the CF-Connecting-IP address.
  • "least_outstanding_requests": Select an origin by taking into consideration origin weights, as well as each origin's number of outstanding requests. Origins with more pending requests are weighted proportionately less relative to others.
  • "least_connections": Select an origin by taking into consideration origin weights, as well as each origin's number of open connections. Origins with more open connections are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
origins: Set[Attributes]

The list of origins within this pool. Traffic directed at this pool is balanced across all currently healthy origins, provided the pool itself is healthy.

address: String

The IP address (IPv4 or IPv6) of the origin, or its publicly addressable hostname. Hostnames entered here should resolve directly to the origin, and not be a hostname proxied by Cloudflare. To set an internal/reserved address, virtual_network_id must also be set.

disabled_at: Time

This field shows up only if the origin is disabled. This field is set with the time the origin was disabled.

enabled: Bool

Whether to enable (the default) this origin within the pool. Disabled origins will not receive traffic and are excluded from health checks. The origin will only be disabled for the current pool.

header: Attributes

The request header is used to pass additional information with an HTTP request. Currently supported header is 'Host'.

host: List[String]

The 'Host' header allows to override the hostname set in the HTTP request. Current support is 1 'Host' header override per origin.

name: String

A human-identifiable name for the origin.

port: Int64

The port for upstream connections. A value of 0 means the default port for the protocol will be used.

virtual_network_id: String

The virtual network subnet ID the origin belongs in. Virtual network must also belong to the account.

weight: Float64

The weight of this origin relative to other origins in the pool. Based on the configured weight the total traffic is distributed among origins within the pool.

  • origin_steering.policy="least_outstanding_requests": Use weight to scale the origin's outstanding requests.
  • origin_steering.policy="least_connections": Use weight to scale the origin's open connections.

cloudflare_load_balancer_pools

data "cloudflare_load_balancer_pools" "example_load_balancer_pools" {
  account_id = "023e105f4ecef8ad9ca31a8372d0c353"
  monitor = "monitor"
}