dtcloud_lb_balancing_pool (Resource)
Builds a listener, its pool, a health monitor and the members in a single call. A create-only shortcut; prefer the granular resources.
Example Usage
# The whole chain in one call: listener, pool, health monitor and members.
# Every argument is ForceNew -- changing one rebuilds all four objects.
resource "dtcloud_lb_balancing_pool" "web" {
lb_id = dtcloud_lb.public.id
# Front end
protocol = "HTTP"
protocol_port = 80
# Back end
backend_protocol = "HTTP"
backend_protocol_port = 8080
lb_algorithm = "ROUND_ROBIN"
# Health monitor. `protocol` here is the probe type, not a network protocol.
health_monitor {
protocol = "HTTP"
url_path = "/healthz"
interval = 10
timeout = 5
healthy_threshold = 2
unhealthy_threshold = 3
}
member {
compute_server_id = dtcloud_vm.web.id
address = dtcloud_vm.web.primary_ip
protocol_port = 8080
}
}
Every argument here forces a new resource. There is no update endpoint for the chain as a
unit, so changing the probe interval recreates the listener and drops the members with it. Prefer
dtcloud_lb_listener, dtcloud_lb_pool, dtcloud_lb_member and dtcloud_lb_health_monitor unless
you specifically want the atomic shape, and never mix the two styles on one load balancer.
Schema
Required
backend_protocol(String) Protocol used to reach the members. Changing this forces a new resource to be created.backend_protocol_port(Number) Port used to reach the members. Changing this forces a new resource to be created.healthy_threshold(Number) Consecutive successes before a member counts as healthy. Changing this forces a new resource to be created.interval(Number) Seconds between probes (5-300). Changing this forces a new resource to be created.lb_algorithm(String) Balancing algorithm. Changing this forces a new resource to be created.lb_id(String) ID of the load balancer. Changing this forces a new resource to be created.lb_port(Number) Front-end port. Changing this forces a new resource to be created.lb_protocol(String) Front-end protocol. One of: HTTP, HTTPS, TCP, UDP, TERMINATED_HTTPS. Changing this forces a new resource to be created.sticky_session(Boolean) Whether to pin a client to the member it first reached. Changing this forces a new resource to be created.timeout(Number) Seconds to wait for a probe response (5-60). Changing this forces a new resource to be created.type(String) Health probe type. Changing this forces a new resource to be created.unhealthy_threshold(Number) Consecutive failures before a member counts as unhealthy. Changing this forces a new resource to be created.
Optional
allowed_cidrs(List of String) CIDRs permitted to reach the listener. Changing this forces a new resource to be created.certificate(String, Sensitive) PEM certificate for TERMINATED_HTTPS. Changing this forces a new resource to be created.connection_limit(Number) Maximum number of concurrent connections. -1 means no limit. Changing this forces a new resource to be created.insert_headers(Block List, Max: 1) Headers the listener injects into requests forwarded to members. Changing this forces a new resource to be created. (see below for nested schema)member(Block List) Back-end members created together with the pool. Changing this forces a new resource to be created. (see below for nested schema)private_key(String, Sensitive) PEM private key for TERMINATED_HTTPS. Changing this forces a new resource to be created.timeout_client_data(Number) Client inactivity timeout in SECONDS (note: dtcloud_lb_listener takes milliseconds). Changing this forces a new resource to be created.timeout_member_connect(Number) Member connect timeout in SECONDS (note: dtcloud_lb_listener takes milliseconds). Changing this forces a new resource to be created.timeout_member_data(Number) Member inactivity timeout in SECONDS (note: dtcloud_lb_listener takes milliseconds). Changing this forces a new resource to be created.timeouts(Block, Optional) (see below for nested schema)url_path(String) Path requested by HTTP and HTTPS probes. Changing this forces a new resource to be created.
Read-Only
balancing_pool_id(String) ID of the balancing pool on its own, without the load balancer prefix.health_monitor_id(String) ID of the health monitor the platform created.id(String) The ID of this resource.listener_id(String) ID of the listener the platform created.members_state(List of String) Operating state of each member.members_total(Number) Number of members in the pool.status(String) Status reported by the platform.
Nested Schema for insert_headers
Optional:
x_forwarded_for(String) Changing this forces a new resource to be created.x_forwarded_port(String) Changing this forces a new resource to be created.x_forwarded_proto(String) Changing this forces a new resource to be created.x_ssl_client_cn(String) Changing this forces a new resource to be created.x_ssl_client_dn(String) Changing this forces a new resource to be created.x_ssl_client_has_cert(String) Changing this forces a new resource to be created.x_ssl_client_not_after(String) Changing this forces a new resource to be created.x_ssl_client_not_before(String) Changing this forces a new resource to be created.x_ssl_client_sha1(String) Changing this forces a new resource to be created.x_ssl_client_verify(String) Changing this forces a new resource to be created.x_ssl_issuer(String) Changing this forces a new resource to be created.
Nested Schema for member
Required:
address(String) IP address of the member. Changing this forces a new resource to be created.compute_server_id(String) ID of the VM behind this address. Changing this forces a new resource to be created.protocol_port(Number) Port the member listens on. Changing this forces a new resource to be created.
Nested Schema for timeouts
Optional:
create(String)delete(String)
Behaviour worth knowing
- The three listener timings are seconds here, where
dtcloud_lb_listenertakes milliseconds. That asymmetry belongs to the API: this endpoint converts, the listener endpoint does not. - Left unset, the platform fills several values in -- the timings,
url_pathandconnection_limit-- and reports what it chose. They are Computed for that reason; without it an omitted value would disagree with the report and, being ForceNew, propose a rebuild on every plan. health_monitor.protocolis the probe type, not a network protocol.
Timeouts
create and delete each default to 30 minutes. There is no update.
Import
# <load-balancer-id>:<balancing-pool-id>. Import one only when it declares no
# `member` blocks: a member's port is reported by nothing, so declared members
# come back empty and the first plan proposes a rebuild.
terraform import dtcloud_lb_balancing_pool.web 3d372446-4c75-4327-9511-98442456162f:5b2a9c31-7e04-4d88-9c6e-44a2f1d0e7b3
member blocks do not survive an import: nothing reports a member's port. Import a balancing pool
only when it declares no members, or accept that the first apply rebuilds it.