Listener

class Listener : KotlinCustomResource

Provides an Application Load Balancer Listener resource. For information about slb and how to use it, see What is Server Load Balancer. For information about listener and how to use it, to see the following:

NOTE: Available since v1.0.0.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.slb.ApplicationLoadBalancer;
import com.pulumi.alicloud.slb.ApplicationLoadBalancerArgs;
import com.pulumi.alicloud.slb.Acl;
import com.pulumi.alicloud.slb.AclArgs;
import com.pulumi.alicloud.slb.Listener;
import com.pulumi.alicloud.slb.ListenerArgs;
import com.pulumi.alicloud.slb.inputs.ListenerXForwardedForArgs;
import com.pulumi.alicloud.slb.AclEntryAttachment;
import com.pulumi.alicloud.slb.AclEntryAttachmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var slbListenerName = config.get("slbListenerName").orElse("forSlbListener");
var listenerApplicationLoadBalancer = new ApplicationLoadBalancer("listenerApplicationLoadBalancer", ApplicationLoadBalancerArgs.builder()
.loadBalancerName("tf-exampleSlbListenerHttp")
.internetChargeType("PayByTraffic")
.addressType("internet")
.instanceChargeType("PayByCLCU")
.build());
var listenerAcl = new Acl("listenerAcl", AclArgs.builder()
.ipVersion("ipv4")
.build());
var listenerListener = new Listener("listenerListener", ListenerArgs.builder()
.loadBalancerId(listenerApplicationLoadBalancer.id())
.backendPort(80)
.frontendPort(80)
.protocol("http")
.bandwidth(10)
.stickySession("on")
.stickySessionType("insert")
.cookieTimeout(86400)
.cookie("tfslblistenercookie")
.healthCheck("on")
.healthCheckDomain("ali.com")
.healthCheckUri("/cons")
.healthCheckConnectPort(20)
.healthyThreshold(8)
.unhealthyThreshold(8)
.healthCheckTimeout(8)
.healthCheckInterval(5)
.healthCheckHttpCode("http_2xx,http_3xx")
.xForwardedFor(ListenerXForwardedForArgs.builder()
.retriveSlbIp(true)
.retriveSlbId(true)
.build())
.aclStatus("on")
.aclType("white")
.aclId(listenerAcl.id())
.requestTimeout(80)
.idleTimeout(30)
.build());
var first = new AclEntryAttachment("first", AclEntryAttachmentArgs.builder()
.aclId(listenerAcl.id())
.entry("10.10.10.0/24")
.comment("first")
.build());
var second = new AclEntryAttachment("second", AclEntryAttachmentArgs.builder()
.aclId(listenerAcl.id())
.entry("168.10.10.0/24")
.comment("second")
.build());
}
}

Listener fields and protocol mapping

load balance support 4 protocol to listen on, they are http,https,tcp,udp, the every listener support which portocal following: listener parameter | support protocol | value range | ------------- | ------------- | ------------- | backend_port | http & https & tcp & udp | 1-65535 | frontend_port | http & https & tcp & udp | 1-65535 | protocol | http & https & tcp & udp | bandwidth | http & https & tcp & udp | -1 / 1-1000 | scheduler | http & https & tcp & udp | wrr, rr, wlc, tch, qch | sticky_session | http & https | on or off | sticky_session_type | http & https | insert or server | cookie_timeout | http & https | 1-86400 | cookie | http & https | | persistence_timeout | tcp & udp | 0-3600 | health_check | http & https | on or off | health_check_type | tcp | tcp or http | health_check_domain | http & https & tcp | health_check_method | http & https & tcp | health_check_uri | http & https & tcp | | health_check_connect_port | http & https & tcp & udp | 1-65535 or -520 | healthy_threshold | http & https & tcp & udp | 1-10 | unhealthy_threshold | http & https & tcp & udp | 1-10 | health_check_timeout | http & https & tcp & udp | 1-300 | health_check_interval | http & https & tcp & udp | 1-50 | health_check_http_code | http & https & tcp | http_2xx,http_3xx,http_4xx,http_5xx | server_certificate_id | https | | gzip | http & https | true or false | x_forwarded_for | http & https | | acl_status | http & https & tcp & udp | on or off | acl_type | http & https & tcp & udp | white or black | acl_id | http & https & tcp & udp | the id of resource alicloud_slb_acl| established_timeout | tcp | 10-900| idle_timeout |http & https | 1-60 | request_timeout |http & https | 1-180 | enable_http2 |https | on or off | tls_cipher_policy |https | tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict | server_group_id | http & https & tcp & udp | the id of resource alicloud.slb.ServerGroup | The listener mapping supports the following:

Import

Load balancer listener can be imported using the id, e.g.

$ pulumi import alicloud:slb/listener:Listener example "lb-abc123456:tcp:22"

Properties

Link copied to clipboard
val aclId: Output<String>?

the id of access control list to be apply on the listener, is the id of resource alicloud_slb_acl. If acl_status is "on", it is mandatory. Otherwise, it will be ignored.

Link copied to clipboard
val aclStatus: Output<String>?

Whether to enable "acl(access control list)", the acl is specified by acl_id. Valid values are on and off. Default to off.

Link copied to clipboard
val aclType: Output<String>?

Mode for handling the acl specified by acl_id. If acl_status is "on", it is mandatory. Otherwise, it will be ignored. Valid values are white and black. white means the Listener can only be accessed by client ip belongs to the acl; black means the Listener can not be accessed by client ip belongs to the acl.

Link copied to clipboard
val backendPort: Output<Int>?

Port used by the Server Load Balancer instance backend. Valid value range: 1-65535.

Link copied to clipboard
val bandwidth: Output<Int>

Bandwidth peak of Listener. For the public network instance charged per traffic consumed, the Bandwidth on Listener can be set to -1, indicating the bandwidth peak is unlimited. Valid values are -1, 1-1000 in Mbps.

Link copied to clipboard
val caCertificateId: Output<String>?

SLB CA certificate ID. Only when protocol is https can be specified.

Link copied to clipboard
val cookie: Output<String>?

The cookie configured on the server. It is mandatory when sticky_session is "on" and sticky_session_type is "server". Otherwise, it will be ignored. Valid value:String in line with RFC 2965, with length being 1- 200. It only contains characters such as ASCII codes, English letters and digits instead of the comma, semicolon or spacing, and it cannot start with $.

Link copied to clipboard
val cookieTimeout: Output<Int>?

Cookie timeout. It is mandatory when sticky_session is "on" and sticky_session_type is "insert". Otherwise, it will be ignored. Valid value range: 1-86400 in seconds.

Link copied to clipboard

Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.

Link copied to clipboard
val description: Output<String>?

The description of slb listener. This description can have a string of 1 to 80 characters. Default value: null.

Link copied to clipboard
val enableHttp2: Output<String>?

Whether to enable https listener support http2 or not. Valid values are on and off. Default to on.

Link copied to clipboard
val establishedTimeout: Output<Int>?

Timeout of tcp listener established connection idle timeout. Valid value range: 10-900 in seconds. Default to 900.

Link copied to clipboard
val forwardPort: Output<Int>?

The port that http redirect to https.

Link copied to clipboard
val frontendPort: Output<Int>

Port used by the Server Load Balancer instance frontend. Valid value range: 1-65535.

Link copied to clipboard
val gzip: Output<Boolean>?

Whether to enable "Gzip Compression". If enabled, files of specific file types will be compressed, otherwise, no files will be compressed. Default to true. Available since v1.13.0+.

Link copied to clipboard
val healthCheck: Output<String>?

Whether to enable health check. Valid values areon and off. TCP and UDP listener's HealthCheck is always on, so it will be ignore when launching TCP or UDP listener.

Link copied to clipboard

The port that is used for health checks. Valid value range: 0-65535. Default to 0 means that the port on a backend server is used for health checks.

Link copied to clipboard

Domain name used for health check. When it used to launch TCP listener, health_check_type must be "http". Its length is limited to 1-80 and only characters such as letters, digits, ‘-‘ and ‘.’ are allowed. When it is not set or empty, Server Load Balancer uses the private network IP address of each backend server as Domain used for health check.

Link copied to clipboard

Regular health check HTTP status code. Multiple codes are segmented by “,”. It is required when health_check is on. Default to http_2xx. Valid values are: http_2xx, http_3xx, http_4xx and http_5xx.

Link copied to clipboard
val healthCheckInterval: Output<Int>?

Time interval of health checks. It is required when health_check is on. Valid value range: 1-50 in seconds. Default to 2.

Link copied to clipboard

HealthCheckMethod used for health check.Valid values: "head", "get" http and https support regions ap-northeast-1, ap-southeast-1, ap-southeast-2, ap-southeast-3, us-east-1, us-west-1, eu-central-1, ap-south-1, me-east-1, cn-huhehaote, cn-zhangjiakou, ap-southeast-5, cn-shenzhen, cn-hongkong, cn-qingdao, cn-chengdu, eu-west-1, cn-hangzhou", cn-beijing, cn-shanghai.This function does not support the TCP protocol .

Link copied to clipboard
val healthCheckTimeout: Output<Int>?

Maximum timeout of each health check response. It is required when health_check is on. Valid value range: 1-300 in seconds. Default to 5. Note: If health_check_timeout<health_check_interval, its will be replaced by health_check_interval.

Link copied to clipboard
val healthCheckType: Output<String>?

Type of health check. Valid values are: tcp and http. Default to tcp . TCP supports TCP and HTTP health check mode, you can select the particular mode depending on your application.

Link copied to clipboard
val healthCheckUri: Output<String>?

URI used for health check. When it used to launch TCP listener, health_check_type must be "http". Its length is limited to 1-80 and it must start with /. Only characters such as letters, digits, ‘-’, ‘/’, ‘.’, ‘%’, ‘?’, #’ and ‘&’ are allowed.

Link copied to clipboard
val healthyThreshold: Output<Int>?

The number of health checks that an unhealthy backend server must consecutively pass before it can be declared healthy. In this case, the health check state is changed from fail to success. It is required when health_check is on. Valid value range: 2-10 in seconds. Default to 3. NOTE: This parameter takes effect only if the health_check parameter is set to on.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val idleTimeout: Output<Int>?

Timeout of http or https listener established connection idle timeout. Valid value range: 1-60 in seconds. Default to 15.

Link copied to clipboard
val lbPort: Output<Int>?
Link copied to clipboard
val lbProtocol: Output<String>?
Link copied to clipboard
val listenerForward: Output<String>

Whether to enable http redirect to https, Valid values are on and off. Default to off.

Link copied to clipboard
val loadBalancerId: Output<String>

The Load Balancer ID which is used to launch a new listener.

Link copied to clipboard

The ID of the master slave server group.

Link copied to clipboard
val persistenceTimeout: Output<Int>?

Timeout of connection persistence. Valid value range: 0-3600 in seconds. Default to 0 and means closing it.

Link copied to clipboard
val protocol: Output<String>

The protocol to listen on. Valid values are `http`, `https`, `tcp`, `udp`.

Link copied to clipboard

Whether to support carrying the client source address to the backend server through the Proxy Protocol. Valid values are true and false. Default to false.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val requestTimeout: Output<Int>?

Timeout of http or https listener request (which does not get response from backend) timeout. Valid value range: 1-180 in seconds. Default to 60.

Link copied to clipboard
val scheduler: Output<String>?

Scheduling algorithm, Valid values: wrr, rr, wlc, sch, tcp, qch. Default to wrr. Only when protocol is tcp or udp, scheduler can be set to sch. Only when instance is guaranteed-performance instance and protocol is tcp or udp, scheduler can be set to tch. Only when instance is guaranteed-performance instance and protocol is udp, scheduler can be set to qch.

Link copied to clipboard

SLB Server certificate ID. It is required when protocol is https. The server_certificate_id is also required when the value of the ssl_certificate_id is Empty.

Link copied to clipboard
val serverGroupId: Output<String>?

the id of server group to be apply on the listener, is the id of resource alicloud.slb.ServerGroup.

Link copied to clipboard

SLB Server certificate ID. It has been deprecated from 1.59.0 and using server_certificate_id instead.

Link copied to clipboard
val stickySession: Output<String>?

Whether to enable session persistence, Valid values are on and off. Default to off.

Link copied to clipboard

Mode for handling the cookie. If sticky_session is "on", it is mandatory. Otherwise, it will be ignored. Valid values are insert and server. insert means it is inserted from Server Load Balancer; server means the Server Load Balancer learns from the backend server.

Link copied to clipboard
val tlsCipherPolicy: Output<String>?

Https listener TLS cipher policy. Valid values are tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict. Default to tls_cipher_policy_1_0. Currently the tls_cipher_policy can not be updated when load balancer instance is "Shared-Performance".

Link copied to clipboard
val unhealthyThreshold: Output<Int>?

The number of health checks that a healthy backend server must consecutively fail before it can be declared unhealthy. In this case, the health check state is changed from success to fail. It is required when health_check is on. Valid value range: 2-10 in seconds. Default to 3. NOTE: This parameter takes effect only if the health_check parameter is set to on.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

Whether to set additional HTTP Header field "X-Forwarded-For" (documented below). Available since v1.13.0+. See x_forwarded_for below.