1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. nlb
  5. Listener
Alibaba Cloud v3.55.0 published on Tuesday, Apr 30, 2024 by Pulumi

alicloud.nlb.Listener

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.55.0 published on Tuesday, Apr 30, 2024 by Pulumi

    Provides a NLB Listener resource.

    For information about NLB Listener and how to use it, see What is Listener.

    NOTE: Available since v1.191.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const default = alicloud.resourcemanager.getResourceGroups({});
    const defaultGetZones = alicloud.nlb.getZones({});
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "10.4.0.0/16",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: name,
        cidrBlock: "10.4.0.0/24",
        vpcId: defaultNetwork.id,
        zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id),
    });
    const default1 = new alicloud.vpc.Switch("default1", {
        vswitchName: name,
        cidrBlock: "10.4.1.0/24",
        vpcId: defaultNetwork.id,
        zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[1]?.id),
    });
    const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {
        name: name,
        vpcId: defaultNetwork.id,
    });
    const defaultLoadBalancer = new alicloud.nlb.LoadBalancer("default", {
        loadBalancerName: name,
        resourceGroupId: _default.then(_default => _default.ids?.[0]),
        loadBalancerType: "Network",
        addressType: "Internet",
        addressIpVersion: "Ipv4",
        vpcId: defaultNetwork.id,
        tags: {
            Created: "TF",
            For: "example",
        },
        zoneMappings: [
            {
                vswitchId: defaultSwitch.id,
                zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[0]?.id),
            },
            {
                vswitchId: default1.id,
                zoneId: defaultGetZones.then(defaultGetZones => defaultGetZones.zones?.[1]?.id),
            },
        ],
    });
    const defaultServerGroup = new alicloud.nlb.ServerGroup("default", {
        resourceGroupId: _default.then(_default => _default.ids?.[0]),
        serverGroupName: name,
        serverGroupType: "Instance",
        vpcId: defaultNetwork.id,
        scheduler: "Wrr",
        protocol: "TCP",
        connectionDrainEnabled: true,
        connectionDrainTimeout: 60,
        addressIpVersion: "Ipv4",
        healthCheck: {
            healthCheckEnabled: true,
            healthCheckType: "TCP",
            healthCheckConnectPort: 0,
            healthyThreshold: 2,
            unhealthyThreshold: 2,
            healthCheckConnectTimeout: 5,
            healthCheckInterval: 10,
            httpCheckMethod: "GET",
            healthCheckHttpCodes: [
                "http_2xx",
                "http_3xx",
                "http_4xx",
            ],
        },
        tags: {
            Created: "TF",
            For: "example",
        },
    });
    const defaultListener = new alicloud.nlb.Listener("default", {
        listenerProtocol: "TCP",
        listenerPort: 80,
        listenerDescription: name,
        loadBalancerId: defaultLoadBalancer.id,
        serverGroupId: defaultServerGroup.id,
        idleTimeout: 900,
        proxyProtocolEnabled: true,
        cps: 10000,
        mss: 0,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.resourcemanager.get_resource_groups()
    default_get_zones = alicloud.nlb.get_zones()
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="10.4.0.0/16")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=name,
        cidr_block="10.4.0.0/24",
        vpc_id=default_network.id,
        zone_id=default_get_zones.zones[0].id)
    default1 = alicloud.vpc.Switch("default1",
        vswitch_name=name,
        cidr_block="10.4.1.0/24",
        vpc_id=default_network.id,
        zone_id=default_get_zones.zones[1].id)
    default_security_group = alicloud.ecs.SecurityGroup("default",
        name=name,
        vpc_id=default_network.id)
    default_load_balancer = alicloud.nlb.LoadBalancer("default",
        load_balancer_name=name,
        resource_group_id=default.ids[0],
        load_balancer_type="Network",
        address_type="Internet",
        address_ip_version="Ipv4",
        vpc_id=default_network.id,
        tags={
            "Created": "TF",
            "For": "example",
        },
        zone_mappings=[
            alicloud.nlb.LoadBalancerZoneMappingArgs(
                vswitch_id=default_switch.id,
                zone_id=default_get_zones.zones[0].id,
            ),
            alicloud.nlb.LoadBalancerZoneMappingArgs(
                vswitch_id=default1.id,
                zone_id=default_get_zones.zones[1].id,
            ),
        ])
    default_server_group = alicloud.nlb.ServerGroup("default",
        resource_group_id=default.ids[0],
        server_group_name=name,
        server_group_type="Instance",
        vpc_id=default_network.id,
        scheduler="Wrr",
        protocol="TCP",
        connection_drain_enabled=True,
        connection_drain_timeout=60,
        address_ip_version="Ipv4",
        health_check=alicloud.nlb.ServerGroupHealthCheckArgs(
            health_check_enabled=True,
            health_check_type="TCP",
            health_check_connect_port=0,
            healthy_threshold=2,
            unhealthy_threshold=2,
            health_check_connect_timeout=5,
            health_check_interval=10,
            http_check_method="GET",
            health_check_http_codes=[
                "http_2xx",
                "http_3xx",
                "http_4xx",
            ],
        ),
        tags={
            "Created": "TF",
            "For": "example",
        })
    default_listener = alicloud.nlb.Listener("default",
        listener_protocol="TCP",
        listener_port=80,
        listener_description=name,
        load_balancer_id=default_load_balancer.id,
        server_group_id=default_server_group.id,
        idle_timeout=900,
        proxy_protocol_enabled=True,
        cps=10000,
        mss=0)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/nlb"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := resourcemanager.GetResourceGroups(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultGetZones, err := nlb.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("10.4.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VswitchName: pulumi.String(name),
    			CidrBlock:   pulumi.String("10.4.0.0/24"),
    			VpcId:       defaultNetwork.ID(),
    			ZoneId:      pulumi.String(defaultGetZones.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		default1, err := vpc.NewSwitch(ctx, "default1", &vpc.SwitchArgs{
    			VswitchName: pulumi.String(name),
    			CidrBlock:   pulumi.String("10.4.1.0/24"),
    			VpcId:       defaultNetwork.ID(),
    			ZoneId:      pulumi.String(defaultGetZones.Zones[1].Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
    			Name:  pulumi.String(name),
    			VpcId: defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultLoadBalancer, err := nlb.NewLoadBalancer(ctx, "default", &nlb.LoadBalancerArgs{
    			LoadBalancerName: pulumi.String(name),
    			ResourceGroupId:  pulumi.String(_default.Ids[0]),
    			LoadBalancerType: pulumi.String("Network"),
    			AddressType:      pulumi.String("Internet"),
    			AddressIpVersion: pulumi.String("Ipv4"),
    			VpcId:            defaultNetwork.ID(),
    			Tags: pulumi.Map{
    				"Created": pulumi.Any("TF"),
    				"For":     pulumi.Any("example"),
    			},
    			ZoneMappings: nlb.LoadBalancerZoneMappingArray{
    				&nlb.LoadBalancerZoneMappingArgs{
    					VswitchId: defaultSwitch.ID(),
    					ZoneId:    pulumi.String(defaultGetZones.Zones[0].Id),
    				},
    				&nlb.LoadBalancerZoneMappingArgs{
    					VswitchId: default1.ID(),
    					ZoneId:    pulumi.String(defaultGetZones.Zones[1].Id),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultServerGroup, err := nlb.NewServerGroup(ctx, "default", &nlb.ServerGroupArgs{
    			ResourceGroupId:        pulumi.String(_default.Ids[0]),
    			ServerGroupName:        pulumi.String(name),
    			ServerGroupType:        pulumi.String("Instance"),
    			VpcId:                  defaultNetwork.ID(),
    			Scheduler:              pulumi.String("Wrr"),
    			Protocol:               pulumi.String("TCP"),
    			ConnectionDrainEnabled: pulumi.Bool(true),
    			ConnectionDrainTimeout: pulumi.Int(60),
    			AddressIpVersion:       pulumi.String("Ipv4"),
    			HealthCheck: &nlb.ServerGroupHealthCheckArgs{
    				HealthCheckEnabled:        pulumi.Bool(true),
    				HealthCheckType:           pulumi.String("TCP"),
    				HealthCheckConnectPort:    pulumi.Int(0),
    				HealthyThreshold:          pulumi.Int(2),
    				UnhealthyThreshold:        pulumi.Int(2),
    				HealthCheckConnectTimeout: pulumi.Int(5),
    				HealthCheckInterval:       pulumi.Int(10),
    				HttpCheckMethod:           pulumi.String("GET"),
    				HealthCheckHttpCodes: pulumi.StringArray{
    					pulumi.String("http_2xx"),
    					pulumi.String("http_3xx"),
    					pulumi.String("http_4xx"),
    				},
    			},
    			Tags: pulumi.Map{
    				"Created": pulumi.Any("TF"),
    				"For":     pulumi.Any("example"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = nlb.NewListener(ctx, "default", &nlb.ListenerArgs{
    			ListenerProtocol:     pulumi.String("TCP"),
    			ListenerPort:         pulumi.Int(80),
    			ListenerDescription:  pulumi.String(name),
    			LoadBalancerId:       defaultLoadBalancer.ID(),
    			ServerGroupId:        defaultServerGroup.ID(),
    			IdleTimeout:          pulumi.Int(900),
    			ProxyProtocolEnabled: pulumi.Bool(true),
    			Cps:                  pulumi.Int(10000),
    			Mss:                  pulumi.Int(0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.ResourceManager.GetResourceGroups.Invoke();
    
        var defaultGetZones = AliCloud.Nlb.GetZones.Invoke();
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "10.4.0.0/16",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = name,
            CidrBlock = "10.4.0.0/24",
            VpcId = defaultNetwork.Id,
            ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        });
    
        var default1 = new AliCloud.Vpc.Switch("default1", new()
        {
            VswitchName = name,
            CidrBlock = "10.4.1.0/24",
            VpcId = defaultNetwork.Id,
            ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[1]?.Id),
        });
    
        var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
        {
            Name = name,
            VpcId = defaultNetwork.Id,
        });
    
        var defaultLoadBalancer = new AliCloud.Nlb.LoadBalancer("default", new()
        {
            LoadBalancerName = name,
            ResourceGroupId = @default.Apply(@default => @default.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[0])),
            LoadBalancerType = "Network",
            AddressType = "Internet",
            AddressIpVersion = "Ipv4",
            VpcId = defaultNetwork.Id,
            Tags = 
            {
                { "Created", "TF" },
                { "For", "example" },
            },
            ZoneMappings = new[]
            {
                new AliCloud.Nlb.Inputs.LoadBalancerZoneMappingArgs
                {
                    VswitchId = defaultSwitch.Id,
                    ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
                },
                new AliCloud.Nlb.Inputs.LoadBalancerZoneMappingArgs
                {
                    VswitchId = default1.Id,
                    ZoneId = defaultGetZones.Apply(getZonesResult => getZonesResult.Zones[1]?.Id),
                },
            },
        });
    
        var defaultServerGroup = new AliCloud.Nlb.ServerGroup("default", new()
        {
            ResourceGroupId = @default.Apply(@default => @default.Apply(getResourceGroupsResult => getResourceGroupsResult.Ids[0])),
            ServerGroupName = name,
            ServerGroupType = "Instance",
            VpcId = defaultNetwork.Id,
            Scheduler = "Wrr",
            Protocol = "TCP",
            ConnectionDrainEnabled = true,
            ConnectionDrainTimeout = 60,
            AddressIpVersion = "Ipv4",
            HealthCheck = new AliCloud.Nlb.Inputs.ServerGroupHealthCheckArgs
            {
                HealthCheckEnabled = true,
                HealthCheckType = "TCP",
                HealthCheckConnectPort = 0,
                HealthyThreshold = 2,
                UnhealthyThreshold = 2,
                HealthCheckConnectTimeout = 5,
                HealthCheckInterval = 10,
                HttpCheckMethod = "GET",
                HealthCheckHttpCodes = new[]
                {
                    "http_2xx",
                    "http_3xx",
                    "http_4xx",
                },
            },
            Tags = 
            {
                { "Created", "TF" },
                { "For", "example" },
            },
        });
    
        var defaultListener = new AliCloud.Nlb.Listener("default", new()
        {
            ListenerProtocol = "TCP",
            ListenerPort = 80,
            ListenerDescription = name,
            LoadBalancerId = defaultLoadBalancer.Id,
            ServerGroupId = defaultServerGroup.Id,
            IdleTimeout = 900,
            ProxyProtocolEnabled = true,
            Cps = 10000,
            Mss = 0,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
    import com.pulumi.alicloud.resourcemanager.inputs.GetResourceGroupsArgs;
    import com.pulumi.alicloud.nlb.NlbFunctions;
    import com.pulumi.alicloud.nlb.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.ecs.SecurityGroup;
    import com.pulumi.alicloud.ecs.SecurityGroupArgs;
    import com.pulumi.alicloud.nlb.LoadBalancer;
    import com.pulumi.alicloud.nlb.LoadBalancerArgs;
    import com.pulumi.alicloud.nlb.inputs.LoadBalancerZoneMappingArgs;
    import com.pulumi.alicloud.nlb.ServerGroup;
    import com.pulumi.alicloud.nlb.ServerGroupArgs;
    import com.pulumi.alicloud.nlb.inputs.ServerGroupHealthCheckArgs;
    import com.pulumi.alicloud.nlb.Listener;
    import com.pulumi.alicloud.nlb.ListenerArgs;
    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 name = config.get("name").orElse("tf-example");
            final var default = ResourcemanagerFunctions.getResourceGroups();
    
            final var defaultGetZones = NlbFunctions.getZones();
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()        
                .vpcName(name)
                .cidrBlock("10.4.0.0/16")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()        
                .vswitchName(name)
                .cidrBlock("10.4.0.0/24")
                .vpcId(defaultNetwork.id())
                .zoneId(defaultGetZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .build());
    
            var default1 = new Switch("default1", SwitchArgs.builder()        
                .vswitchName(name)
                .cidrBlock("10.4.1.0/24")
                .vpcId(defaultNetwork.id())
                .zoneId(defaultGetZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
                .build());
    
            var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()        
                .name(name)
                .vpcId(defaultNetwork.id())
                .build());
    
            var defaultLoadBalancer = new LoadBalancer("defaultLoadBalancer", LoadBalancerArgs.builder()        
                .loadBalancerName(name)
                .resourceGroupId(default_.ids()[0])
                .loadBalancerType("Network")
                .addressType("Internet")
                .addressIpVersion("Ipv4")
                .vpcId(defaultNetwork.id())
                .tags(Map.ofEntries(
                    Map.entry("Created", "TF"),
                    Map.entry("For", "example")
                ))
                .zoneMappings(            
                    LoadBalancerZoneMappingArgs.builder()
                        .vswitchId(defaultSwitch.id())
                        .zoneId(defaultGetZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                        .build(),
                    LoadBalancerZoneMappingArgs.builder()
                        .vswitchId(default1.id())
                        .zoneId(defaultGetZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
                        .build())
                .build());
    
            var defaultServerGroup = new ServerGroup("defaultServerGroup", ServerGroupArgs.builder()        
                .resourceGroupId(default_.ids()[0])
                .serverGroupName(name)
                .serverGroupType("Instance")
                .vpcId(defaultNetwork.id())
                .scheduler("Wrr")
                .protocol("TCP")
                .connectionDrainEnabled(true)
                .connectionDrainTimeout(60)
                .addressIpVersion("Ipv4")
                .healthCheck(ServerGroupHealthCheckArgs.builder()
                    .healthCheckEnabled(true)
                    .healthCheckType("TCP")
                    .healthCheckConnectPort(0)
                    .healthyThreshold(2)
                    .unhealthyThreshold(2)
                    .healthCheckConnectTimeout(5)
                    .healthCheckInterval(10)
                    .httpCheckMethod("GET")
                    .healthCheckHttpCodes(                
                        "http_2xx",
                        "http_3xx",
                        "http_4xx")
                    .build())
                .tags(Map.ofEntries(
                    Map.entry("Created", "TF"),
                    Map.entry("For", "example")
                ))
                .build());
    
            var defaultListener = new Listener("defaultListener", ListenerArgs.builder()        
                .listenerProtocol("TCP")
                .listenerPort("80")
                .listenerDescription(name)
                .loadBalancerId(defaultLoadBalancer.id())
                .serverGroupId(defaultServerGroup.id())
                .idleTimeout("900")
                .proxyProtocolEnabled("true")
                .cps("10000")
                .mss("0")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          vpcName: ${name}
          cidrBlock: 10.4.0.0/16
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vswitchName: ${name}
          cidrBlock: 10.4.0.0/24
          vpcId: ${defaultNetwork.id}
          zoneId: ${defaultGetZones.zones[0].id}
      default1:
        type: alicloud:vpc:Switch
        properties:
          vswitchName: ${name}
          cidrBlock: 10.4.1.0/24
          vpcId: ${defaultNetwork.id}
          zoneId: ${defaultGetZones.zones[1].id}
      defaultSecurityGroup:
        type: alicloud:ecs:SecurityGroup
        name: default
        properties:
          name: ${name}
          vpcId: ${defaultNetwork.id}
      defaultLoadBalancer:
        type: alicloud:nlb:LoadBalancer
        name: default
        properties:
          loadBalancerName: ${name}
          resourceGroupId: ${default.ids[0]}
          loadBalancerType: Network
          addressType: Internet
          addressIpVersion: Ipv4
          vpcId: ${defaultNetwork.id}
          tags:
            Created: TF
            For: example
          zoneMappings:
            - vswitchId: ${defaultSwitch.id}
              zoneId: ${defaultGetZones.zones[0].id}
            - vswitchId: ${default1.id}
              zoneId: ${defaultGetZones.zones[1].id}
      defaultServerGroup:
        type: alicloud:nlb:ServerGroup
        name: default
        properties:
          resourceGroupId: ${default.ids[0]}
          serverGroupName: ${name}
          serverGroupType: Instance
          vpcId: ${defaultNetwork.id}
          scheduler: Wrr
          protocol: TCP
          connectionDrainEnabled: true
          connectionDrainTimeout: 60
          addressIpVersion: Ipv4
          healthCheck:
            healthCheckEnabled: true
            healthCheckType: TCP
            healthCheckConnectPort: 0
            healthyThreshold: 2
            unhealthyThreshold: 2
            healthCheckConnectTimeout: 5
            healthCheckInterval: 10
            httpCheckMethod: GET
            healthCheckHttpCodes:
              - http_2xx
              - http_3xx
              - http_4xx
          tags:
            Created: TF
            For: example
      defaultListener:
        type: alicloud:nlb:Listener
        name: default
        properties:
          listenerProtocol: TCP
          listenerPort: '80'
          listenerDescription: ${name}
          loadBalancerId: ${defaultLoadBalancer.id}
          serverGroupId: ${defaultServerGroup.id}
          idleTimeout: '900'
          proxyProtocolEnabled: 'true'
          cps: '10000'
          mss: '0'
    variables:
      default:
        fn::invoke:
          Function: alicloud:resourcemanager:getResourceGroups
          Arguments: {}
      defaultGetZones:
        fn::invoke:
          Function: alicloud:nlb:getZones
          Arguments: {}
    

    Create Listener Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Listener(name: string, args: ListenerArgs, opts?: CustomResourceOptions);
    @overload
    def Listener(resource_name: str,
                 args: ListenerArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def Listener(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 listener_port: Optional[int] = None,
                 server_group_id: Optional[str] = None,
                 load_balancer_id: Optional[str] = None,
                 listener_protocol: Optional[str] = None,
                 cps: Optional[int] = None,
                 ca_certificate_ids: Optional[Sequence[str]] = None,
                 end_port: Optional[int] = None,
                 idle_timeout: Optional[int] = None,
                 listener_description: Optional[str] = None,
                 certificate_ids: Optional[Sequence[str]] = None,
                 ca_enabled: Optional[bool] = None,
                 alpn_enabled: Optional[bool] = None,
                 mss: Optional[int] = None,
                 proxy_protocol_enabled: Optional[bool] = None,
                 sec_sensor_enabled: Optional[bool] = None,
                 security_policy_id: Optional[str] = None,
                 alpn_policy: Optional[str] = None,
                 start_port: Optional[int] = None,
                 status: Optional[str] = None,
                 tags: Optional[Mapping[str, Any]] = None)
    func NewListener(ctx *Context, name string, args ListenerArgs, opts ...ResourceOption) (*Listener, error)
    public Listener(string name, ListenerArgs args, CustomResourceOptions? opts = null)
    public Listener(String name, ListenerArgs args)
    public Listener(String name, ListenerArgs args, CustomResourceOptions options)
    
    type: alicloud:nlb:Listener
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ListenerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var examplelistenerResourceResourceFromNlblistener = new AliCloud.Nlb.Listener("examplelistenerResourceResourceFromNlblistener", new()
    {
        ListenerPort = 0,
        ServerGroupId = "string",
        LoadBalancerId = "string",
        ListenerProtocol = "string",
        Cps = 0,
        CaCertificateIds = new[]
        {
            "string",
        },
        EndPort = 0,
        IdleTimeout = 0,
        ListenerDescription = "string",
        CertificateIds = new[]
        {
            "string",
        },
        CaEnabled = false,
        AlpnEnabled = false,
        Mss = 0,
        ProxyProtocolEnabled = false,
        SecSensorEnabled = false,
        SecurityPolicyId = "string",
        AlpnPolicy = "string",
        StartPort = 0,
        Status = "string",
        Tags = 
        {
            { "string", "any" },
        },
    });
    
    example, err := nlb.NewListener(ctx, "examplelistenerResourceResourceFromNlblistener", &nlb.ListenerArgs{
    	ListenerPort:     pulumi.Int(0),
    	ServerGroupId:    pulumi.String("string"),
    	LoadBalancerId:   pulumi.String("string"),
    	ListenerProtocol: pulumi.String("string"),
    	Cps:              pulumi.Int(0),
    	CaCertificateIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	EndPort:             pulumi.Int(0),
    	IdleTimeout:         pulumi.Int(0),
    	ListenerDescription: pulumi.String("string"),
    	CertificateIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	CaEnabled:            pulumi.Bool(false),
    	AlpnEnabled:          pulumi.Bool(false),
    	Mss:                  pulumi.Int(0),
    	ProxyProtocolEnabled: pulumi.Bool(false),
    	SecSensorEnabled:     pulumi.Bool(false),
    	SecurityPolicyId:     pulumi.String("string"),
    	AlpnPolicy:           pulumi.String("string"),
    	StartPort:            pulumi.Int(0),
    	Status:               pulumi.String("string"),
    	Tags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    })
    
    var examplelistenerResourceResourceFromNlblistener = new Listener("examplelistenerResourceResourceFromNlblistener", ListenerArgs.builder()        
        .listenerPort(0)
        .serverGroupId("string")
        .loadBalancerId("string")
        .listenerProtocol("string")
        .cps(0)
        .caCertificateIds("string")
        .endPort(0)
        .idleTimeout(0)
        .listenerDescription("string")
        .certificateIds("string")
        .caEnabled(false)
        .alpnEnabled(false)
        .mss(0)
        .proxyProtocolEnabled(false)
        .secSensorEnabled(false)
        .securityPolicyId("string")
        .alpnPolicy("string")
        .startPort(0)
        .status("string")
        .tags(Map.of("string", "any"))
        .build());
    
    examplelistener_resource_resource_from_nlblistener = alicloud.nlb.Listener("examplelistenerResourceResourceFromNlblistener",
        listener_port=0,
        server_group_id="string",
        load_balancer_id="string",
        listener_protocol="string",
        cps=0,
        ca_certificate_ids=["string"],
        end_port=0,
        idle_timeout=0,
        listener_description="string",
        certificate_ids=["string"],
        ca_enabled=False,
        alpn_enabled=False,
        mss=0,
        proxy_protocol_enabled=False,
        sec_sensor_enabled=False,
        security_policy_id="string",
        alpn_policy="string",
        start_port=0,
        status="string",
        tags={
            "string": "any",
        })
    
    const examplelistenerResourceResourceFromNlblistener = new alicloud.nlb.Listener("examplelistenerResourceResourceFromNlblistener", {
        listenerPort: 0,
        serverGroupId: "string",
        loadBalancerId: "string",
        listenerProtocol: "string",
        cps: 0,
        caCertificateIds: ["string"],
        endPort: 0,
        idleTimeout: 0,
        listenerDescription: "string",
        certificateIds: ["string"],
        caEnabled: false,
        alpnEnabled: false,
        mss: 0,
        proxyProtocolEnabled: false,
        secSensorEnabled: false,
        securityPolicyId: "string",
        alpnPolicy: "string",
        startPort: 0,
        status: "string",
        tags: {
            string: "any",
        },
    });
    
    type: alicloud:nlb:Listener
    properties:
        alpnEnabled: false
        alpnPolicy: string
        caCertificateIds:
            - string
        caEnabled: false
        certificateIds:
            - string
        cps: 0
        endPort: 0
        idleTimeout: 0
        listenerDescription: string
        listenerPort: 0
        listenerProtocol: string
        loadBalancerId: string
        mss: 0
        proxyProtocolEnabled: false
        secSensorEnabled: false
        securityPolicyId: string
        serverGroupId: string
        startPort: 0
        status: string
        tags:
            string: any
    

    Listener Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Listener resource accepts the following input properties:

    ListenerPort int
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    ListenerProtocol string
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    LoadBalancerId string
    The ID of the network-based server load balancer instance.
    ServerGroupId string
    The ID of the server group.
    AlpnEnabled bool
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    AlpnPolicy string
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    CaCertificateIds List<string>

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    CaEnabled bool
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    CertificateIds List<string>

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    Cps int
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    EndPort int
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    IdleTimeout int
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    ListenerDescription string
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    Mss int

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    ProxyProtocolEnabled bool
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    SecSensorEnabled bool
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    SecurityPolicyId string

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    StartPort int
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    Status string
    The status of the resource.
    Tags Dictionary<string, object>
    The tag of the resource.
    ListenerPort int
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    ListenerProtocol string
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    LoadBalancerId string
    The ID of the network-based server load balancer instance.
    ServerGroupId string
    The ID of the server group.
    AlpnEnabled bool
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    AlpnPolicy string
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    CaCertificateIds []string

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    CaEnabled bool
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    CertificateIds []string

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    Cps int
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    EndPort int
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    IdleTimeout int
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    ListenerDescription string
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    Mss int

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    ProxyProtocolEnabled bool
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    SecSensorEnabled bool
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    SecurityPolicyId string

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    StartPort int
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    Status string
    The status of the resource.
    Tags map[string]interface{}
    The tag of the resource.
    listenerPort Integer
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listenerProtocol String
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    loadBalancerId String
    The ID of the network-based server load balancer instance.
    serverGroupId String
    The ID of the server group.
    alpnEnabled Boolean
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpnPolicy String
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    caCertificateIds List<String>

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    caEnabled Boolean
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificateIds List<String>

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps Integer
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    endPort Integer
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idleTimeout Integer
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listenerDescription String
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    mss Integer

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxyProtocolEnabled Boolean
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    secSensorEnabled Boolean
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    securityPolicyId String

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    startPort Integer
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status String
    The status of the resource.
    tags Map<String,Object>
    The tag of the resource.
    listenerPort number
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listenerProtocol string
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    loadBalancerId string
    The ID of the network-based server load balancer instance.
    serverGroupId string
    The ID of the server group.
    alpnEnabled boolean
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpnPolicy string
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    caCertificateIds string[]

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    caEnabled boolean
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificateIds string[]

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps number
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    endPort number
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idleTimeout number
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listenerDescription string
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    mss number

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxyProtocolEnabled boolean
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    secSensorEnabled boolean
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    securityPolicyId string

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    startPort number
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status string
    The status of the resource.
    tags {[key: string]: any}
    The tag of the resource.
    listener_port int
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listener_protocol str
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    load_balancer_id str
    The ID of the network-based server load balancer instance.
    server_group_id str
    The ID of the server group.
    alpn_enabled bool
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpn_policy str
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    ca_certificate_ids Sequence[str]

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    ca_enabled bool
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificate_ids Sequence[str]

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps int
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    end_port int
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idle_timeout int
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listener_description str
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    mss int

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxy_protocol_enabled bool
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    sec_sensor_enabled bool
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    security_policy_id str

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    start_port int
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status str
    The status of the resource.
    tags Mapping[str, Any]
    The tag of the resource.
    listenerPort Number
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listenerProtocol String
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    loadBalancerId String
    The ID of the network-based server load balancer instance.
    serverGroupId String
    The ID of the server group.
    alpnEnabled Boolean
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpnPolicy String
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    caCertificateIds List<String>

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    caEnabled Boolean
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificateIds List<String>

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps Number
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    endPort Number
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idleTimeout Number
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listenerDescription String
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    mss Number

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxyProtocolEnabled Boolean
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    secSensorEnabled Boolean
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    securityPolicyId String

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    startPort Number
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status String
    The status of the resource.
    tags Map<Any>
    The tag of the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Listener resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Listener Resource

    Get an existing Listener resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ListenerState, opts?: CustomResourceOptions): Listener
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            alpn_enabled: Optional[bool] = None,
            alpn_policy: Optional[str] = None,
            ca_certificate_ids: Optional[Sequence[str]] = None,
            ca_enabled: Optional[bool] = None,
            certificate_ids: Optional[Sequence[str]] = None,
            cps: Optional[int] = None,
            end_port: Optional[int] = None,
            idle_timeout: Optional[int] = None,
            listener_description: Optional[str] = None,
            listener_port: Optional[int] = None,
            listener_protocol: Optional[str] = None,
            load_balancer_id: Optional[str] = None,
            mss: Optional[int] = None,
            proxy_protocol_enabled: Optional[bool] = None,
            sec_sensor_enabled: Optional[bool] = None,
            security_policy_id: Optional[str] = None,
            server_group_id: Optional[str] = None,
            start_port: Optional[int] = None,
            status: Optional[str] = None,
            tags: Optional[Mapping[str, Any]] = None) -> Listener
    func GetListener(ctx *Context, name string, id IDInput, state *ListenerState, opts ...ResourceOption) (*Listener, error)
    public static Listener Get(string name, Input<string> id, ListenerState? state, CustomResourceOptions? opts = null)
    public static Listener get(String name, Output<String> id, ListenerState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AlpnEnabled bool
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    AlpnPolicy string
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    CaCertificateIds List<string>

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    CaEnabled bool
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    CertificateIds List<string>

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    Cps int
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    EndPort int
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    IdleTimeout int
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    ListenerDescription string
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    ListenerPort int
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    ListenerProtocol string
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    LoadBalancerId string
    The ID of the network-based server load balancer instance.
    Mss int

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    ProxyProtocolEnabled bool
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    SecSensorEnabled bool
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    SecurityPolicyId string

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    ServerGroupId string
    The ID of the server group.
    StartPort int
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    Status string
    The status of the resource.
    Tags Dictionary<string, object>
    The tag of the resource.
    AlpnEnabled bool
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    AlpnPolicy string
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    CaCertificateIds []string

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    CaEnabled bool
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    CertificateIds []string

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    Cps int
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    EndPort int
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    IdleTimeout int
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    ListenerDescription string
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    ListenerPort int
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    ListenerProtocol string
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    LoadBalancerId string
    The ID of the network-based server load balancer instance.
    Mss int

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    ProxyProtocolEnabled bool
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    SecSensorEnabled bool
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    SecurityPolicyId string

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    ServerGroupId string
    The ID of the server group.
    StartPort int
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    Status string
    The status of the resource.
    Tags map[string]interface{}
    The tag of the resource.
    alpnEnabled Boolean
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpnPolicy String
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    caCertificateIds List<String>

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    caEnabled Boolean
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificateIds List<String>

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps Integer
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    endPort Integer
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idleTimeout Integer
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listenerDescription String
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    listenerPort Integer
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listenerProtocol String
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    loadBalancerId String
    The ID of the network-based server load balancer instance.
    mss Integer

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxyProtocolEnabled Boolean
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    secSensorEnabled Boolean
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    securityPolicyId String

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    serverGroupId String
    The ID of the server group.
    startPort Integer
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status String
    The status of the resource.
    tags Map<String,Object>
    The tag of the resource.
    alpnEnabled boolean
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpnPolicy string
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    caCertificateIds string[]

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    caEnabled boolean
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificateIds string[]

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps number
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    endPort number
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idleTimeout number
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listenerDescription string
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    listenerPort number
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listenerProtocol string
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    loadBalancerId string
    The ID of the network-based server load balancer instance.
    mss number

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxyProtocolEnabled boolean
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    secSensorEnabled boolean
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    securityPolicyId string

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    serverGroupId string
    The ID of the server group.
    startPort number
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status string
    The status of the resource.
    tags {[key: string]: any}
    The tag of the resource.
    alpn_enabled bool
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpn_policy str
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    ca_certificate_ids Sequence[str]

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    ca_enabled bool
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificate_ids Sequence[str]

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps int
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    end_port int
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idle_timeout int
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listener_description str
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    listener_port int
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listener_protocol str
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    load_balancer_id str
    The ID of the network-based server load balancer instance.
    mss int

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxy_protocol_enabled bool
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    sec_sensor_enabled bool
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    security_policy_id str

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    server_group_id str
    The ID of the server group.
    start_port int
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status str
    The status of the resource.
    tags Mapping[str, Any]
    The tag of the resource.
    alpnEnabled Boolean
    Whether ALPN is turned on. Value:

    • true: on.
    • false: closed.
    alpnPolicy String
    ALPN policy. Value:

    • HTTP1Only
    • HTTP2Only
    • HTTP2Preferred
    • HTTP2Optional.
    caCertificateIds List<String>

    CA certificate list information. Currently, only one CA certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    caEnabled Boolean
    Whether to start two-way authentication. Value:

    • true: start.
    • false: closed.
    certificateIds List<String>

    Server certificate list information. Currently, only one server certificate can be added.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    cps Number
    The new connection speed limit for a network-based load balancing instance per second. Valid values: 0 ~ 1000000. 0 indicates unlimited speed.
    endPort Number
    Full port listening end port. Valid values: 0 ~ **65535 * *. The value of the end port is less than the start port.
    idleTimeout Number
    Connection idle timeout time. Unit: seconds. Valid values: 1 ~ 900.
    listenerDescription String
    Custom listener name.The length is limited to 2 to 256 characters, supports Chinese and English letters, and can include numbers, commas (,), half-width periods (.), half-width semicolons (;), forward slashes (/), at(@), underscores (_), and dashes (-).
    listenerPort Number
    Listening port. Valid values: 0 ~ **65535 * *. 0: indicates that full port listening is used. When set to 0, you must configure StartPort and EndPort.
    listenerProtocol String
    The listening protocol. Valid values: TCP, UDP, or TCPSSL.
    loadBalancerId String
    The ID of the network-based server load balancer instance.
    mss Number

    The maximum segment size of the TCP message. Unit: Bytes. Valid values: 0 ~ 1500. 0 indicates that the MSS value of the TCP message is not modified.

    NOTE: only TCP and TCPSSL listeners support this field value.

    proxyProtocolEnabled Boolean
    Whether to enable the Proxy Protocol to carry the source address of the client to the backend server. Value:

    • true: on.
    • false: closed.
    secSensorEnabled Boolean
    Whether to turn on the second-level monitoring function. Value:

    • true: on.
    • false: closed.
    securityPolicyId String

    Security policy ID. Support system security policies and custom security policies. Valid values: tls_cipher_policy_1_0, tls_cipher_policy_1_1, tls_cipher_policy_1_2, tls_cipher_policy_1_2_strict, or tls_cipher_policy_1_2_strict_with_1_3.

    NOTE: This parameter only takes effect for TCPSSL listeners.

    serverGroupId String
    The ID of the server group.
    startPort Number
    Full Port listens to the starting port. Valid values: 0 ~ 65535.
    status String
    The status of the resource.
    tags Map<Any>
    The tag of the resource.

    Import

    NLB Listener can be imported using the id, e.g.

    $ pulumi import alicloud:nlb/listener:Listener example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.55.0 published on Tuesday, Apr 30, 2024 by Pulumi