Terraform providerReferenceResources
odinex_load_balancer
Manages a load balancer with its services and targets.
Manages a load balancer with its services and targets.
Example Usage
resource "odinex_load_balancer" "web" {
name = "web"
load_balancer_type = "lb11"
location = "fra1"
algorithm {
type = "least_connections"
}
service {
protocol = "http"
listen_port = 80
health_check {
protocol = "http"
port = 80
http {
path = "/healthz"
}
}
}
target {
type = "label_selector"
label_selector = "role=web"
}
}Schema
Required
load_balancer_type(String) Type of the load balancer, e.g.lb11. Can be changed in place.location(String) Location, e.g.fra1. Changing it recreates the load balancer.name(String) Name of the load balancer.
Optional
algorithm(Block, Optional) Load balancing algorithm. Defaults toround_robin.delete_protection(Boolean) Prevent the resource from being deleted. Defaults tofalse.labels(Map of String) User-defined labels (key/value pairs). Up to 64 pairs; keys and values up to 63 characters.service(Block List) A service (listener). All services are replaced in one call when any of them changes.target(Block Set) A target: a server, a label selector or an IP.timeouts(Block, Optional)
Read-Only
id(String) Unique ID of the resource.ipv4(String) Public IPv4 address.ipv6(String) Public IPv6 address.status(String) Status of the load balancer.
Nested Schema for algorithm
Optional:
type(String)round_robin(default) orleast_connections.
Nested Schema for service
Required:
listen_port(Number) Port the load balancer listens on.protocol(String)tcporhttp.
Optional:
destination_port(Number) Port of the targets; defaults tolisten_port.health_check(Block, Optional) Health check of the targets.http(Block, Optional) HTTP options.proxyprotocol(Boolean) Enable the PROXY protocol.
Nested Schema for service.health_check
Optional:
http(Block, Optional) HTTP health check options.interval(Number) Seconds between checks (default 15).port(Number) Port to check.protocol(String)tcporhttp.retries(Number) Failed checks before a target is unhealthy (default 3).timeout(Number) Timeout in seconds (default 10).
Nested Schema for service.health_check.http
Optional:
path(String) Request path.status_codes(List of String) Accepted status codes, e.g.["2??", "3??"].
Nested Schema for service.http
Optional:
sticky_sessions(Boolean) Enable sticky sessions.
Nested Schema for target
Required:
type(String)server,label_selectororip.
Optional:
ip(String) IP address (typeip).label_selector(String) Label selector (typelabel_selector).server_id(Number) Server ID (typeserver).
Nested Schema for timeouts
Optional:
create(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).delete(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.update(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
terraform import odinex_load_balancer.web 4