<gh_stars>0// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.AliCloud.Alb
{
    /// <summary>
    /// 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](https://www.alibabacloud.com/help/en/server-load-balancer/latest/associateaclswithlistener).
    /// 
    /// &gt; **NOTE:** Available in v1.163.0+.
    /// 
    /// &gt; **NOTE:** You can associate at most three ACLs with a listener.
    /// 
    /// &gt; **NOTE:** You can only configure either a whitelist or a blacklist for listener, not at the same time.
    /// 
    /// ## Example Usage
    /// 
    /// Basic Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var defaultResourceGroups = AliCloud.ResourceManager.GetResourceGroups.Invoke();
    /// 
    ///     var defaultAcl = new AliCloud.Alb.Acl("defaultAcl", new()
    ///     {
    ///         AclName = "example_value",
    ///         ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult =&gt; 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 =&gt; getNetworksResult.Ids[0]),
    ///         ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Zones[0]?.Id),
    ///     });
    /// 
    ///     var default2 = AliCloud.Vpc.GetSwitches.Invoke(new()
    ///     {
    ///         VpcId = defaultNetworks.Apply(getNetworksResult =&gt; getNetworksResult.Ids[0]),
    ///         ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Zones[1]?.Id),
    ///     });
    /// 
    ///     var defaultLoadBalancer = new AliCloud.Alb.LoadBalancer("defaultLoadBalancer", new()
    ///     {
    ///         VpcId = defaultNetworks.Apply(getNetworksResult =&gt; getNetworksResult.Ids[0]),
    ///         AddressType = "Internet",
    ///         AddressAllocatedMode = "Fixed",
    ///         LoadBalancerName = "example_value",
    ///         LoadBalancerEdition = "Standard",
    ///         ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult =&gt; 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 =&gt; getSwitchesResult.Ids[0]),
    ///                 ZoneId = defaultZones.Apply(getZonesResult =&gt; getZonesResult.Zones[0]?.Id),
    ///             },
    ///             new AliCloud.Alb.Inputs.LoadBalancerZoneMappingArgs
    ///             {
    ///                 VswitchId = default2.Apply(getSwitchesResult =&gt; getSwitchesResult.Ids[0]),
    ///                 ZoneId = defaultZones.Apply(getZonesResult =&gt; 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 =&gt; getNetworksResult.Vpcs[0]?.Id),
    ///         ServerGroupName = "example_value",
    ///         ResourceGroupId = defaultResourceGroups.Apply(getResourceGroupsResult =&gt; 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",
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// Application Load Balancer (ALB) Listener Acl Attachment can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:alb/listenerAclAttachment:ListenerAclAttachment example &lt;listener_id&gt;:&lt;acl_id&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:alb/listenerAclAttachment:ListenerAclAttachment")]
    public partial class ListenerAclAttachment : global::Pulumi.CustomResource
    {
        /// <summary>
        /// The ID of the Acl.
        /// </summary>
        [Output("aclId")]
        public Output<string> AclId { get; private set; } = null!;

        /// <summary>
        /// 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.
        /// </summary>
        [Output("aclType")]
        public Output<string> AclType { get; private set; } = null!;

        /// <summary>
        /// The ID of the ALB listener.
        /// </summary>
        [Output("listenerId")]
        public Output<string> ListenerId { get; private set; } = null!;

        /// <summary>
        /// The status of the Listener Acl Attachment.
        /// </summary>
        [Output("status")]
        public Output<string> Status { get; private set; } = null!;


        /// <summary>
        /// Create a ListenerAclAttachment resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public ListenerAclAttachment(string name, ListenerAclAttachmentArgs args, CustomResourceOptions? options = null)
            : base("alicloud:alb/listenerAclAttachment:ListenerAclAttachment", name, args ?? new ListenerAclAttachmentArgs(), MakeResourceOptions(options, ""))
        {
        }

        private ListenerAclAttachment(string name, Input<string> id, ListenerAclAttachmentState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:alb/listenerAclAttachment:ListenerAclAttachment", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/rhysmdnz/pulumi-alicloud",
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing ListenerAclAttachment resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static ListenerAclAttachment Get(string name, Input<string> id, ListenerAclAttachmentState? state = null, CustomResourceOptions? options = null)
        {
            return new ListenerAclAttachment(name, id, state, options);
        }
    }

    public sealed class ListenerAclAttachmentArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The ID of the Acl.
        /// </summary>
        [Input("aclId", required: true)]
        public Input<string> AclId { get; set; } = null!;

        /// <summary>
        /// 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.
        /// </summary>
        [Input("aclType", required: true)]
        public Input<string> AclType { get; set; } = null!;

        /// <summary>
        /// The ID of the ALB listener.
        /// </summary>
        [Input("listenerId", required: true)]
        public Input<string> ListenerId { get; set; } = null!;

        public ListenerAclAttachmentArgs()
        {
        }
        public static new ListenerAclAttachmentArgs Empty => new ListenerAclAttachmentArgs();
    }

    public sealed class ListenerAclAttachmentState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// The ID of the Acl.
        /// </summary>
        [Input("aclId")]
        public Input<string>? AclId { get; set; }

        /// <summary>
        /// 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.
        /// </summary>
        [Input("aclType")]
        public Input<string>? AclType { get; set; }

        /// <summary>
        /// The ID of the ALB listener.
        /// </summary>
        [Input("listenerId")]
        public Input<string>? ListenerId { get; set; }

        /// <summary>
        /// The status of the Listener Acl Attachment.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

        public ListenerAclAttachmentState()
        {
        }
        public static new ListenerAclAttachmentState Empty => new ListenerAclAttachmentState();
    }
}
