Skip to main content

dtcloud_lb_listener (Resource)

Manages a listener on a load balancer: the protocol and port it accepts connections on.

Example Usage​

resource "dtcloud_lb_listener" "https" {
lb_id = dtcloud_lb.public.id
name = "https"
protocol = "HTTPS"
protocol_port = 443

# Only these addresses may reach the listener.
allowed_cidrs = ["10.0.0.0/8"]

# Milliseconds here. dtcloud_lb_balancing_pool takes the same three in seconds.
timeout_client_data = 50000
}

Schema​

Required​

  • lb_id (String) ID of the load balancer this listener belongs to. Changing this forces a new resource to be created.
  • protocol (String) Front-end protocol. One of: HTTP, HTTPS, TCP, UDP. Changing this forces a new resource to be created.
  • protocol_port (Number) Front-end port the listener accepts traffic on. Changing this forces a new resource to be created.

Optional​

  • admin_state_up (Boolean) Whether the listener is administratively up.
  • allowed_cidrs (List of String) CIDRs permitted to reach this listener.
  • connection_limit (Number) Maximum number of concurrent connections.
  • default_pool_id (String) Pool that receives traffic when no other rule matches.
  • description (String) Free-text description.
  • insert_headers (Block List, Max: 1) Headers the listener injects into requests forwarded to members. (see below for nested schema)
  • name (String) Name of the listener.
  • timeout_client_data (Number) Client inactivity timeout in milliseconds.
  • timeout_member_connect (Number) Member connect timeout in milliseconds.
  • timeout_member_data (Number) Member inactivity timeout in milliseconds.
  • timeouts (Block, Optional) (see below for nested schema)

Read-Only​

  • created_at (String) Creation timestamp as reported by the API.
  • id (String) The ID of this resource.
  • listener_id (String) ID of the listener on its own, without the load balancer prefix.
  • operating_status (String) Operating status.
  • provisioning_status (String) Provisioning status.
  • updated_at (String) Last-update timestamp as reported by the API.

Nested Schema for insert_headers​

Optional:

  • x_forwarded_for (String)
  • x_forwarded_port (String)
  • x_forwarded_proto (String)
  • x_ssl_client_cn (String)
  • x_ssl_client_dn (String)
  • x_ssl_client_has_cert (String)
  • x_ssl_client_not_after (String)
  • x_ssl_client_not_before (String)
  • x_ssl_client_sha1 (String)
  • x_ssl_client_verify (String)
  • x_ssl_issuer (String)

Nested Schema for timeouts​

Optional:

  • create (String)
  • delete (String)
  • update (String)

Behaviour worth knowing​

  • protocol and protocol_port are fixed at creation. Everything else changes in place. The create call accepts only the protocol, the port, a name and a description, so the provider applies the rest in a second call right after.
  • The three timeouts are milliseconds here. dtcloud_lb_balancing_pool takes the same three in seconds. The asymmetry is the API's: that endpoint converts, this one does not.
  • Left unset, the platform fills the timeouts and the connection limit in and reports what it chose. They are Computed for that reason, so an omitted value does not read as a difference.
  • allowed_cidrs is answered as null when empty. Only a non-empty list is written to state, so omitting the argument and the platform reporting nothing agree.

Timeouts​

create, update and delete each default to 15 minutes. Every call waits for the parent load balancer to settle first.

Import​

# <load-balancer-id>:<listener-id>
terraform import dtcloud_lb_listener.https 3d372446-4c75-4327-9511-98442456162f:8c1f0b7a-22e5-4a90-b5d1-1f3c9e77a201

The id carries the load balancer, because every listener call is scoped to it and the listener id alone cannot address one.