1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. alb
  5. ListenerAclAttachment
Alibaba Cloud v3.38.0 published on Friday, Jun 2, 2023 by Pulumi

alicloud.alb.ListenerAclAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.38.0 published on Friday, Jun 2, 2023 by Pulumi

    Provides a Application Load Balancer (ALB) Listener Acl Attachment resource.

    For information about Application Load Balancer (ALB) Listener Acl Attachment and how to use it, see What is Listener Acl Attachment.

    NOTE: Available in v1.163.0+.

    NOTE: You can associate at most three ACLs with a listener.

    NOTE: You can only configure either a whitelist or a blacklist for listener, not at the same time.

    Example Usage

    Basic Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var defaultResourceGroups = AliCloud.ResourceManager.GetResourceGroups.Invoke();
    
        var defaultAcl = new AliCloud.Alb.Acl("defaultAcl", new()
        {
            AclName = "example_value",
            ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
            AclEntries = new[]
            {
                new AliCloud.Alb.Inputs.AclAclEntryArgs
                {
                    Description = "description",
                    Entry = "10.0.0.0/24",
                },
            },
        });
    
        var defaultZones = AliCloud.Alb.GetZones.Invoke();
    
        var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
        {
            NameRegex = "default-NODELETING",
        });
    
        var default1 = AliCloud.Vpc.GetSwitches.Invoke(new()
        {
            VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
            ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
        });
    
        var default2 = AliCloud.Vpc.GetSwitches.Invoke(new()
        {
            VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
            ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[1]?.Id),
        });
    
        var defaultLoadBalancer = new AliCloud.Alb.LoadBalancer("defaultLoadBalancer", new()
        {
            VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
            AddressType = "Internet",
            AddressAllocatedMode = "Fixed",
            LoadBalancerName = "example_value",
            LoadBalancerEdition = "Standard",
            ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
            LoadBalancerBillingConfig = new AliCloud.Alb.Inputs.LoadBalancerLoadBalancerBillingConfigArgs
            {
                PayType = "PayAsYouGo",
            },
            Tags = 
            {
                { "Created", "TF" },
            },
            ZoneMappings = new[]
            {
                new AliCloud.Alb.Inputs.LoadBalancerZoneMappingArgs
                {
                    VswitchId = default1.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
                    ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
                },
                new AliCloud.Alb.Inputs.LoadBalancerZoneMappingArgs
                {
                    VswitchId = default2.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
                    ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[1]?.Id),
                },
            },
            ModificationProtectionConfig = new AliCloud.Alb.Inputs.LoadBalancerModificationProtectionConfigArgs
            {
                Status = "NonProtection",
            },
        });
    
        var defaultServerGroup = new AliCloud.Alb.ServerGroup("defaultServerGroup", new()
        {
            Protocol = "HTTP",
            VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Vpcs[0]?.Id),
            ServerGroupName = "example_value",
            ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult => getResourceGroupsResult.Groups[0]?.Id),
            HealthCheckConfig = new AliCloud.Alb.Inputs.ServerGroupHealthCheckConfigArgs
            {
                HealthCheckEnabled = false,
            },
            StickySessionConfig = new AliCloud.Alb.Inputs.ServerGroupStickySessionConfigArgs
            {
                StickySessionEnabled = false,
            },
            Tags = 
            {
                { "Created", "TF" },
            },
        });
    
        var defaultListener = new AliCloud.Alb.Listener("defaultListener", new()
        {
            LoadBalancerId = defaultLoadBalancer.Id,
            ListenerProtocol = "HTTP",
            ListenerPort = 80,
            ListenerDescription = "example_value",
            DefaultActions = new[]
            {
                new AliCloud.Alb.Inputs.ListenerDefaultActionArgs
                {
                    Type = "ForwardGroup",
                    ForwardGroupConfig = new AliCloud.Alb.Inputs.ListenerDefaultActionForwardGroupConfigArgs
                    {
                        ServerGroupTuples = new[]
                        {
                            new AliCloud.Alb.Inputs.ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs
                            {
                                ServerGroupId = defaultServerGroup.Id,
                            },
                        },
                    },
                },
            },
        });
    
        var defaultListenerAclAttachment = new AliCloud.Alb.ListenerAclAttachment("defaultListenerAclAttachment", new()
        {
            AclId = defaultAcl.Id,
            ListenerId = defaultListener.Id,
            AclType = "White",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alb"
    	"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"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		defaultResourceGroups, err := resourcemanager.GetResourceGroups(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultAcl, err := alb.NewAcl(ctx, "defaultAcl", &alb.AclArgs{
    			AclName:         pulumi.String("example_value"),
    			ResourceGroupId: *pulumi.String(defaultResourceGroups.Groups[0].Id),
    			AclEntries: alb.AclAclEntryArray{
    				&alb.AclAclEntryArgs{
    					Description: pulumi.String("description"),
    					Entry:       pulumi.String("10.0.0.0/24"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultZones, err := alb.GetZones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
    			NameRegex: pulumi.StringRef("default-NODELETING"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		default1, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
    			VpcId:  pulumi.StringRef(defaultNetworks.Ids[0]),
    			ZoneId: pulumi.StringRef(defaultZones.Zones[0].Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		default2, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
    			VpcId:  pulumi.StringRef(defaultNetworks.Ids[0]),
    			ZoneId: pulumi.StringRef(defaultZones.Zones[1].Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultLoadBalancer, err := alb.NewLoadBalancer(ctx, "defaultLoadBalancer", &alb.LoadBalancerArgs{
    			VpcId:                *pulumi.String(defaultNetworks.Ids[0]),
    			AddressType:          pulumi.String("Internet"),
    			AddressAllocatedMode: pulumi.String("Fixed"),
    			LoadBalancerName:     pulumi.String("example_value"),
    			LoadBalancerEdition:  pulumi.String("Standard"),
    			ResourceGroupId:      *pulumi.String(defaultResourceGroups.Groups[0].Id),
    			LoadBalancerBillingConfig: &alb.LoadBalancerLoadBalancerBillingConfigArgs{
    				PayType: pulumi.String("PayAsYouGo"),
    			},
    			Tags: pulumi.AnyMap{
    				"Created": pulumi.Any("TF"),
    			},
    			ZoneMappings: alb.LoadBalancerZoneMappingArray{
    				&alb.LoadBalancerZoneMappingArgs{
    					VswitchId: *pulumi.String(default1.Ids[0]),
    					ZoneId:    *pulumi.String(defaultZones.Zones[0].Id),
    				},
    				&alb.LoadBalancerZoneMappingArgs{
    					VswitchId: *pulumi.String(default2.Ids[0]),
    					ZoneId:    *pulumi.String(defaultZones.Zones[1].Id),
    				},
    			},
    			ModificationProtectionConfig: &alb.LoadBalancerModificationProtectionConfigArgs{
    				Status: pulumi.String("NonProtection"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultServerGroup, err := alb.NewServerGroup(ctx, "defaultServerGroup", &alb.ServerGroupArgs{
    			Protocol:        pulumi.String("HTTP"),
    			VpcId:           *pulumi.String(defaultNetworks.Vpcs[0].Id),
    			ServerGroupName: pulumi.String("example_value"),
    			ResourceGroupId: *pulumi.String(defaultResourceGroups.Groups[0].Id),
    			HealthCheckConfig: &alb.ServerGroupHealthCheckConfigArgs{
    				HealthCheckEnabled: pulumi.Bool(false),
    			},
    			StickySessionConfig: &alb.ServerGroupStickySessionConfigArgs{
    				StickySessionEnabled: pulumi.Bool(false),
    			},
    			Tags: pulumi.AnyMap{
    				"Created": pulumi.Any("TF"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		defaultListener, err := alb.NewListener(ctx, "defaultListener", &alb.ListenerArgs{
    			LoadBalancerId:      defaultLoadBalancer.ID(),
    			ListenerProtocol:    pulumi.String("HTTP"),
    			ListenerPort:        pulumi.Int(80),
    			ListenerDescription: pulumi.String("example_value"),
    			DefaultActions: alb.ListenerDefaultActionArray{
    				&alb.ListenerDefaultActionArgs{
    					Type: pulumi.String("ForwardGroup"),
    					ForwardGroupConfig: &alb.ListenerDefaultActionForwardGroupConfigArgs{
    						ServerGroupTuples: alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArray{
    							&alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs{
    								ServerGroupId: defaultServerGroup.ID(),
    							},
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = alb.NewListenerAclAttachment(ctx, "defaultListenerAclAttachment", &alb.ListenerAclAttachmentArgs{
    			AclId:      defaultAcl.ID(),
    			ListenerId: defaultListener.ID(),
    			AclType:    pulumi.String("White"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.alb.Acl;
    import com.pulumi.alicloud.alb.AclArgs;
    import com.pulumi.alicloud.alb.inputs.AclAclEntryArgs;
    import com.pulumi.alicloud.alb.AlbFunctions;
    import com.pulumi.alicloud.alb.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.VpcFunctions;
    import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
    import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
    import com.pulumi.alicloud.alb.LoadBalancer;
    import com.pulumi.alicloud.alb.LoadBalancerArgs;
    import com.pulumi.alicloud.alb.inputs.LoadBalancerLoadBalancerBillingConfigArgs;
    import com.pulumi.alicloud.alb.inputs.LoadBalancerZoneMappingArgs;
    import com.pulumi.alicloud.alb.inputs.LoadBalancerModificationProtectionConfigArgs;
    import com.pulumi.alicloud.alb.ServerGroup;
    import com.pulumi.alicloud.alb.ServerGroupArgs;
    import com.pulumi.alicloud.alb.inputs.ServerGroupHealthCheckConfigArgs;
    import com.pulumi.alicloud.alb.inputs.ServerGroupStickySessionConfigArgs;
    import com.pulumi.alicloud.alb.Listener;
    import com.pulumi.alicloud.alb.ListenerArgs;
    import com.pulumi.alicloud.alb.inputs.ListenerDefaultActionArgs;
    import com.pulumi.alicloud.alb.inputs.ListenerDefaultActionForwardGroupConfigArgs;
    import com.pulumi.alicloud.alb.ListenerAclAttachment;
    import com.pulumi.alicloud.alb.ListenerAclAttachmentArgs;
    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 defaultResourceGroups = ResourcemanagerFunctions.getResourceGroups();
    
            var defaultAcl = new Acl("defaultAcl", AclArgs.builder()        
                .aclName("example_value")
                .resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.groups()[0].id()))
                .aclEntries(AclAclEntryArgs.builder()
                    .description("description")
                    .entry("10.0.0.0/24")
                    .build())
                .build());
    
            final var defaultZones = AlbFunctions.getZones();
    
            final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
                .nameRegex("default-NODELETING")
                .build());
    
            final var default1 = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
                .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
                .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                .build());
    
            final var default2 = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
                .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
                .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
                .build());
    
            var defaultLoadBalancer = new LoadBalancer("defaultLoadBalancer", LoadBalancerArgs.builder()        
                .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
                .addressType("Internet")
                .addressAllocatedMode("Fixed")
                .loadBalancerName("example_value")
                .loadBalancerEdition("Standard")
                .resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.groups()[0].id()))
                .loadBalancerBillingConfig(LoadBalancerLoadBalancerBillingConfigArgs.builder()
                    .payType("PayAsYouGo")
                    .build())
                .tags(Map.of("Created", "TF"))
                .zoneMappings(            
                    LoadBalancerZoneMappingArgs.builder()
                        .vswitchId(default1.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
                        .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
                        .build(),
                    LoadBalancerZoneMappingArgs.builder()
                        .vswitchId(default2.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
                        .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[1].id()))
                        .build())
                .modificationProtectionConfig(LoadBalancerModificationProtectionConfigArgs.builder()
                    .status("NonProtection")
                    .build())
                .build());
    
            var defaultServerGroup = new ServerGroup("defaultServerGroup", ServerGroupArgs.builder()        
                .protocol("HTTP")
                .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.vpcs()[0].id()))
                .serverGroupName("example_value")
                .resourceGroupId(defaultResourceGroups.applyValue(getResourceGroupsResult -> getResourceGroupsResult.groups()[0].id()))
                .healthCheckConfig(ServerGroupHealthCheckConfigArgs.builder()
                    .healthCheckEnabled("false")
                    .build())
                .stickySessionConfig(ServerGroupStickySessionConfigArgs.builder()
                    .stickySessionEnabled("false")
                    .build())
                .tags(Map.of("Created", "TF"))
                .build());
    
            var defaultListener = new Listener("defaultListener", ListenerArgs.builder()        
                .loadBalancerId(defaultLoadBalancer.id())
                .listenerProtocol("HTTP")
                .listenerPort(80)
                .listenerDescription("example_value")
                .defaultActions(ListenerDefaultActionArgs.builder()
                    .type("ForwardGroup")
                    .forwardGroupConfig(ListenerDefaultActionForwardGroupConfigArgs.builder()
                        .serverGroupTuples(ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs.builder()
                            .serverGroupId(defaultServerGroup.id())
                            .build())
                        .build())
                    .build())
                .build());
    
            var defaultListenerAclAttachment = new ListenerAclAttachment("defaultListenerAclAttachment", ListenerAclAttachmentArgs.builder()        
                .aclId(defaultAcl.id())
                .listenerId(defaultListener.id())
                .aclType("White")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default_resource_groups = alicloud.resourcemanager.get_resource_groups()
    default_acl = alicloud.alb.Acl("defaultAcl",
        acl_name="example_value",
        resource_group_id=default_resource_groups.groups[0].id,
        acl_entries=[alicloud.alb.AclAclEntryArgs(
            description="description",
            entry="10.0.0.0/24",
        )])
    default_zones = alicloud.alb.get_zones()
    default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
    default1 = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0],
        zone_id=default_zones.zones[0].id)
    default2 = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0],
        zone_id=default_zones.zones[1].id)
    default_load_balancer = alicloud.alb.LoadBalancer("defaultLoadBalancer",
        vpc_id=default_networks.ids[0],
        address_type="Internet",
        address_allocated_mode="Fixed",
        load_balancer_name="example_value",
        load_balancer_edition="Standard",
        resource_group_id=default_resource_groups.groups[0].id,
        load_balancer_billing_config=alicloud.alb.LoadBalancerLoadBalancerBillingConfigArgs(
            pay_type="PayAsYouGo",
        ),
        tags={
            "Created": "TF",
        },
        zone_mappings=[
            alicloud.alb.LoadBalancerZoneMappingArgs(
                vswitch_id=default1.ids[0],
                zone_id=default_zones.zones[0].id,
            ),
            alicloud.alb.LoadBalancerZoneMappingArgs(
                vswitch_id=default2.ids[0],
                zone_id=default_zones.zones[1].id,
            ),
        ],
        modification_protection_config=alicloud.alb.LoadBalancerModificationProtectionConfigArgs(
            status="NonProtection",
        ))
    default_server_group = alicloud.alb.ServerGroup("defaultServerGroup",
        protocol="HTTP",
        vpc_id=default_networks.vpcs[0].id,
        server_group_name="example_value",
        resource_group_id=default_resource_groups.groups[0].id,
        health_check_config=alicloud.alb.ServerGroupHealthCheckConfigArgs(
            health_check_enabled=False,
        ),
        sticky_session_config=alicloud.alb.ServerGroupStickySessionConfigArgs(
            sticky_session_enabled=False,
        ),
        tags={
            "Created": "TF",
        })
    default_listener = alicloud.alb.Listener("defaultListener",
        load_balancer_id=default_load_balancer.id,
        listener_protocol="HTTP",
        listener_port=80,
        listener_description="example_value",
        default_actions=[alicloud.alb.ListenerDefaultActionArgs(
            type="ForwardGroup",
            forward_group_config=alicloud.alb.ListenerDefaultActionForwardGroupConfigArgs(
                server_group_tuples=[alicloud.alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs(
                    server_group_id=default_server_group.id,
                )],
            ),
        )])
    default_listener_acl_attachment = alicloud.alb.ListenerAclAttachment("defaultListenerAclAttachment",
        acl_id=default_acl.id,
        listener_id=default_listener.id,
        acl_type="White")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const defaultResourceGroups = alicloud.resourcemanager.getResourceGroups({});
    const defaultAcl = new alicloud.alb.Acl("defaultAcl", {
        aclName: "example_value",
        resourceGroupId: defaultResourceGroups.then(defaultResourceGroups => defaultResourceGroups.groups?.[0]?.id),
        aclEntries: [{
            description: "description",
            entry: "10.0.0.0/24",
        }],
    });
    const defaultZones = alicloud.alb.getZones({});
    const defaultNetworks = alicloud.vpc.getNetworks({
        nameRegex: "default-NODELETING",
    });
    const default1 = Promise.all([defaultNetworks, defaultZones]).then(([defaultNetworks, defaultZones]) => alicloud.vpc.getSwitches({
        vpcId: defaultNetworks.ids?.[0],
        zoneId: defaultZones.zones?.[0]?.id,
    }));
    const default2 = Promise.all([defaultNetworks, defaultZones]).then(([defaultNetworks, defaultZones]) => alicloud.vpc.getSwitches({
        vpcId: defaultNetworks.ids?.[0],
        zoneId: defaultZones.zones?.[1]?.id,
    }));
    const defaultLoadBalancer = new alicloud.alb.LoadBalancer("defaultLoadBalancer", {
        vpcId: defaultNetworks.then(defaultNetworks => defaultNetworks.ids?.[0]),
        addressType: "Internet",
        addressAllocatedMode: "Fixed",
        loadBalancerName: "example_value",
        loadBalancerEdition: "Standard",
        resourceGroupId: defaultResourceGroups.then(defaultResourceGroups => defaultResourceGroups.groups?.[0]?.id),
        loadBalancerBillingConfig: {
            payType: "PayAsYouGo",
        },
        tags: {
            Created: "TF",
        },
        zoneMappings: [
            {
                vswitchId: default1.then(default1 => default1.ids?.[0]),
                zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.id),
            },
            {
                vswitchId: default2.then(default2 => default2.ids?.[0]),
                zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[1]?.id),
            },
        ],
        modificationProtectionConfig: {
            status: "NonProtection",
        },
    });
    const defaultServerGroup = new alicloud.alb.ServerGroup("defaultServerGroup", {
        protocol: "HTTP",
        vpcId: defaultNetworks.then(defaultNetworks => defaultNetworks.vpcs?.[0]?.id),
        serverGroupName: "example_value",
        resourceGroupId: defaultResourceGroups.then(defaultResourceGroups => defaultResourceGroups.groups?.[0]?.id),
        healthCheckConfig: {
            healthCheckEnabled: false,
        },
        stickySessionConfig: {
            stickySessionEnabled: false,
        },
        tags: {
            Created: "TF",
        },
    });
    const defaultListener = new alicloud.alb.Listener("defaultListener", {
        loadBalancerId: defaultLoadBalancer.id,
        listenerProtocol: "HTTP",
        listenerPort: 80,
        listenerDescription: "example_value",
        defaultActions: [{
            type: "ForwardGroup",
            forwardGroupConfig: {
                serverGroupTuples: [{
                    serverGroupId: defaultServerGroup.id,
                }],
            },
        }],
    });
    const defaultListenerAclAttachment = new alicloud.alb.ListenerAclAttachment("defaultListenerAclAttachment", {
        aclId: defaultAcl.id,
        listenerId: defaultListener.id,
        aclType: "White",
    });
    
    resources:
      defaultAcl:
        type: alicloud:alb:Acl
        properties:
          aclName: example_value
          resourceGroupId: ${defaultResourceGroups.groups[0].id}
          aclEntries:
            - description: description
              entry: 10.0.0.0/24
      defaultLoadBalancer:
        type: alicloud:alb:LoadBalancer
        properties:
          vpcId: ${defaultNetworks.ids[0]}
          addressType: Internet
          addressAllocatedMode: Fixed
          loadBalancerName: example_value
          loadBalancerEdition: Standard
          resourceGroupId: ${defaultResourceGroups.groups[0].id}
          loadBalancerBillingConfig:
            payType: PayAsYouGo
          tags:
            Created: TF
          zoneMappings:
            - vswitchId: ${default1.ids[0]}
              zoneId: ${defaultZones.zones[0].id}
            - vswitchId: ${default2.ids[0]}
              zoneId: ${defaultZones.zones[1].id}
          modificationProtectionConfig:
            status: NonProtection
      defaultServerGroup:
        type: alicloud:alb:ServerGroup
        properties:
          protocol: HTTP
          vpcId: ${defaultNetworks.vpcs[0].id}
          serverGroupName: example_value
          resourceGroupId: ${defaultResourceGroups.groups[0].id}
          healthCheckConfig:
            healthCheckEnabled: 'false'
          stickySessionConfig:
            stickySessionEnabled: 'false'
          tags:
            Created: TF
      defaultListener:
        type: alicloud:alb:Listener
        properties:
          loadBalancerId: ${defaultLoadBalancer.id}
          listenerProtocol: HTTP
          listenerPort: 80
          listenerDescription: example_value
          defaultActions:
            - type: ForwardGroup
              forwardGroupConfig:
                serverGroupTuples:
                  - serverGroupId: ${defaultServerGroup.id}
      defaultListenerAclAttachment:
        type: alicloud:alb:ListenerAclAttachment
        properties:
          aclId: ${defaultAcl.id}
          listenerId: ${defaultListener.id}
          aclType: White
    variables:
      defaultResourceGroups:
        fn::invoke:
          Function: alicloud:resourcemanager:getResourceGroups
          Arguments: {}
      defaultZones:
        fn::invoke:
          Function: alicloud:alb:getZones
          Arguments: {}
      defaultNetworks:
        fn::invoke:
          Function: alicloud:vpc:getNetworks
          Arguments:
            nameRegex: default-NODELETING
      default1:
        fn::invoke:
          Function: alicloud:vpc:getSwitches
          Arguments:
            vpcId: ${defaultNetworks.ids[0]}
            zoneId: ${defaultZones.zones[0].id}
      default2:
        fn::invoke:
          Function: alicloud:vpc:getSwitches
          Arguments:
            vpcId: ${defaultNetworks.ids[0]}
            zoneId: ${defaultZones.zones[1].id}
    

    Create ListenerAclAttachment Resource

    new ListenerAclAttachment(name: string, args: ListenerAclAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def ListenerAclAttachment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              acl_id: Optional[str] = None,
                              acl_type: Optional[str] = None,
                              listener_id: Optional[str] = None)
    @overload
    def ListenerAclAttachment(resource_name: str,
                              args: ListenerAclAttachmentArgs,
                              opts: Optional[ResourceOptions] = None)
    func NewListenerAclAttachment(ctx *Context, name string, args ListenerAclAttachmentArgs, opts ...ResourceOption) (*ListenerAclAttachment, error)
    public ListenerAclAttachment(string name, ListenerAclAttachmentArgs args, CustomResourceOptions? opts = null)
    public ListenerAclAttachment(String name, ListenerAclAttachmentArgs args)
    public ListenerAclAttachment(String name, ListenerAclAttachmentArgs args, CustomResourceOptions options)
    
    type: alicloud:alb:ListenerAclAttachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ListenerAclAttachmentArgs
    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 ListenerAclAttachmentArgs
    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 ListenerAclAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ListenerAclAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ListenerAclAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ListenerAclAttachment 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 ListenerAclAttachment resource accepts the following input properties:

    AclId string

    The ID of the Acl.

    AclType string

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    ListenerId string

    The ID of the ALB listener.

    AclId string

    The ID of the Acl.

    AclType string

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    ListenerId string

    The ID of the ALB listener.

    aclId String

    The ID of the Acl.

    aclType String

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listenerId String

    The ID of the ALB listener.

    aclId string

    The ID of the Acl.

    aclType string

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listenerId string

    The ID of the ALB listener.

    acl_id str

    The ID of the Acl.

    acl_type str

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listener_id str

    The ID of the ALB listener.

    aclId String

    The ID of the Acl.

    aclType String

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listenerId String

    The ID of the ALB listener.

    Outputs

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Status string

    The status of the Listener Acl Attachment.

    Id string

    The provider-assigned unique ID for this managed resource.

    Status string

    The status of the Listener Acl Attachment.

    id String

    The provider-assigned unique ID for this managed resource.

    status String

    The status of the Listener Acl Attachment.

    id string

    The provider-assigned unique ID for this managed resource.

    status string

    The status of the Listener Acl Attachment.

    id str

    The provider-assigned unique ID for this managed resource.

    status str

    The status of the Listener Acl Attachment.

    id String

    The provider-assigned unique ID for this managed resource.

    status String

    The status of the Listener Acl Attachment.

    Look up Existing ListenerAclAttachment Resource

    Get an existing ListenerAclAttachment 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?: ListenerAclAttachmentState, opts?: CustomResourceOptions): ListenerAclAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            acl_id: Optional[str] = None,
            acl_type: Optional[str] = None,
            listener_id: Optional[str] = None,
            status: Optional[str] = None) -> ListenerAclAttachment
    func GetListenerAclAttachment(ctx *Context, name string, id IDInput, state *ListenerAclAttachmentState, opts ...ResourceOption) (*ListenerAclAttachment, error)
    public static ListenerAclAttachment Get(string name, Input<string> id, ListenerAclAttachmentState? state, CustomResourceOptions? opts = null)
    public static ListenerAclAttachment get(String name, Output<String> id, ListenerAclAttachmentState 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:
    AclId string

    The ID of the Acl.

    AclType string

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    ListenerId string

    The ID of the ALB listener.

    Status string

    The status of the Listener Acl Attachment.

    AclId string

    The ID of the Acl.

    AclType string

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    ListenerId string

    The ID of the ALB listener.

    Status string

    The status of the Listener Acl Attachment.

    aclId String

    The ID of the Acl.

    aclType String

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listenerId String

    The ID of the ALB listener.

    status String

    The status of the Listener Acl Attachment.

    aclId string

    The ID of the Acl.

    aclType string

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listenerId string

    The ID of the ALB listener.

    status string

    The status of the Listener Acl Attachment.

    acl_id str

    The ID of the Acl.

    acl_type str

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listener_id str

    The ID of the ALB listener.

    status str

    The status of the Listener Acl Attachment.

    aclId String

    The ID of the Acl.

    aclType String

    The type of the ACL. Valid values:

    • White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
    • Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
    listenerId String

    The ID of the ALB listener.

    status String

    The status of the Listener Acl Attachment.

    Import

    Application Load Balancer (ALB) Listener Acl Attachment can be imported using the id, e.g.

     $ pulumi import alicloud:alb/listenerAclAttachment:ListenerAclAttachment example <listener_id>:<acl_id>
    

    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.38.0 published on Friday, Jun 2, 2023 by Pulumi