Resource

dcloud_lb_service

A listener of a load balancer: a port it accepts on and the port of the targets it forwards to. Health check and sticky-session settings change in place. For https, give domains (Deutsche Cloud issues the certificate over DNS-01 in your hosted zones) or your own certificate_pem and private_key_pem.

Example Usage

# https with a certificate Deutsche Cloud issues for names in your hosted zones.
resource "dcloud_lb_service" "https" {
  load_balancer_id = dcloud_lb.web.id
  protocol         = "https"
  source_port      = 443
  destination_port = 8080
  domains          = ["www.example.com"]
  redirect_http    = true

  health_check_protocol = "http"
  health_check_path     = "/healthz"
  health_check_interval = 10
}

Schema

Required

  • destination_port (Number) Port on the targets traffic is sent to, 1–65535. The console’s form starts on 80. From 1 to 65535. Changing it replaces the resource.
  • load_balancer_id (String) The id of the parent resource ({id} in the path). Changing it replaces the resource.
  • protocol (String) What the load balancer speaks on sourcePort. https terminates TLS and needs a certificate (domains, or certificatePem + privateKeyPem), except on an application load balancer, whose platform name is served by the fleet’s own certificate when neither is given. tcp is refused (400) on application load balancers One of: tcp, http, https. Changing it replaces the resource.
  • source_port (Number) Port the load balancer listens on, 1–65535; one service per port (400 when taken, and port 80 is taken by an https service that redirects). application: http on 80 and https on 443 only (400). dedicated: not 22, 9901 or 9902 (400), at most 10 services. The console’s form starts on 80 (443 for https). From 1 to 65535. Changing it replaces the resource.

Optional

  • certificate_pem (String) https only, instead of domains: your certificate in PEM, leaf first, then the chain; at most 64 KiB. Must parse and match privateKeyPem (400). Never renewed by the platform. Up to 65536 characters. Never returned by the API: not read back, and empty after an import. Changing it replaces the resource.
  • close_on_unhealthy (Boolean) dedicated tcp only (400 on the other types and protocols): close open connections to a target whose health check answers no (an HTTP status outside 2xx/3xx, retries times in a row); a check that only times out closes nothing. For a database primary endpoint. Default false Changing it replaces the resource.
  • domains (List of String) https only (400 otherwise): names for a certificate Deutsche Cloud issues and renews over DNS-01, at most 50, each up to 253 characters; lower-cased and de-duplicated. Every name (wildcards allowed) must be in one of your Deutsche Cloud hosted zones (400). Not together with certificatePem (400). application: at most 10 names including its platform name, and none another load balancer on the fleet already serves (400) Changing it replaces the resource.
  • health_check_interval (Number) Seconds between health checks (default 15): 3–60 on lb11/lb21/lb31 (400 below 3), 1–60 on application and dedicated load balancers. From 1 to 60.
  • health_check_path (String) HTTP path probed for health when healthCheckProtocol is http (default /). Not checked here; services update requires a leading / and at most 256 characters
  • health_check_port (Number) dedicated type only (400 on the others): the port the health check asks, 1–65535 (default: the target port), e.g. an HTTP health endpoint next to a tcp service. From 1 to 65535. Changing it replaces the resource.
  • health_check_protocol (String) http (default): GET the health-check path, 2xx/3xx is healthy. tcp: a connection is enough One of: http, tcp.
  • health_check_retries (Number) Failed checks in a row before a target stops taking traffic (0–5, default 3). A dead target keeps traffic for about interval × (retries + 1). From 0 to 5.
  • health_check_timeout (Number) Seconds a health check may take, 1–60 and at most the interval (400 above it; default 10). From 1 to 60.
  • private_key_pem (String, Sensitive) https, with certificatePem (400 with one but not the other): its unencrypted private key in PEM, at most 16 KiB. lb11/lb21/lb31: handed to the provider and not stored by Deutsche Cloud. application and dedicated: stored sealed under the KMS master key, opened only to configure the fleet. Up to 16384 characters. Never returned by the API: not read back, and empty after an import. Changing it replaces the resource.
  • proxyprotocol (Boolean) Prepend the PROXY protocol header to each connection to a target. Default false. Refused (400) on application load balancers, whose targets get X-Forwarded-For and X-Real-IP instead Changing it replaces the resource.
  • redirect_http (Boolean) https only: answer port 80 with a 301 redirect to https. Port 80 must be free and the service may not itself listen on 80 (400). Default false in the API; the console’s form ticks it Changing it replaces the resource.
  • sticky_cookie_lifetime (Number) Seconds the sticky-session cookie lasts (60 s – 7 days, default 300). From 60 to 604800.
  • sticky_cookie_name (String) Name of the sticky-session cookie (default EWSLB). Must match ^[A-Za-z0-9_-]{1,64}$.
  • sticky_sessions (Boolean) http/https: pin each client to one target with a cookie the load balancer sets (default false; refused with 400 on a tcp service)

Read-Only

  • certificate_not_after (String) https: when the certificate expires.
  • certificate_status (String) https: where the certificate stands.
  • id (String) The resource's id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# An uploaded certificate_pem / private_key_pem is never read back.
terraform import dcloud_lb_service.https <load-balancer-id>/<service-id>

Generated from the provider's schema.