1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. waf
  5. ProtectionModule
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.waf.ProtectionModule

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a Web Application Firewall(WAF) Protection Module resource.

    For information about Web Application Firewall(WAF) Protection Module and how to use it, see What is Protection Module.

    NOTE: Available in v1.141.0+.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.waf.getInstances({});
    const defaultDomain = new alicloud.waf.Domain("default", {
        domainName: "you domain",
        instanceId: _default.then(_default => _default.ids?.[0]),
        isAccessProduct: "On",
        sourceIps: ["1.1.1.1"],
        clusterType: "PhysicalCluster",
        http2Ports: ["443"],
        httpPorts: ["80"],
        httpsPorts: ["443"],
        httpToUserIp: "Off",
        httpsRedirect: "Off",
        loadBalancing: "IpHash",
        logHeaders: [{
            key: "foo",
            value: "http",
        }],
    });
    const defaultProtectionModule = new alicloud.waf.ProtectionModule("default", {
        instanceId: _default.then(_default => _default.ids?.[0]),
        domain: defaultDomain.domainName,
        defenseType: "ac_cc",
        mode: 0,
        status: 0,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.waf.get_instances()
    default_domain = alicloud.waf.Domain("default",
        domain_name="you domain",
        instance_id=default.ids[0],
        is_access_product="On",
        source_ips=["1.1.1.1"],
        cluster_type="PhysicalCluster",
        http2_ports=["443"],
        http_ports=["80"],
        https_ports=["443"],
        http_to_user_ip="Off",
        https_redirect="Off",
        load_balancing="IpHash",
        log_headers=[alicloud.waf.DomainLogHeaderArgs(
            key="foo",
            value="http",
        )])
    default_protection_module = alicloud.waf.ProtectionModule("default",
        instance_id=default.ids[0],
        domain=default_domain.domain_name,
        defense_type="ac_cc",
        mode=0,
        status=0)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/waf"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := waf.GetInstances(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		defaultDomain, err := waf.NewDomain(ctx, "default", &waf.DomainArgs{
    			DomainName:      pulumi.String("you domain"),
    			InstanceId:      pulumi.String(_default.Ids[0]),
    			IsAccessProduct: pulumi.String("On"),
    			SourceIps: pulumi.StringArray{
    				pulumi.String("1.1.1.1"),
    			},
    			ClusterType: pulumi.String("PhysicalCluster"),
    			Http2Ports: pulumi.StringArray{
    				pulumi.String("443"),
    			},
    			HttpPorts: pulumi.StringArray{
    				pulumi.String("80"),
    			},
    			HttpsPorts: pulumi.StringArray{
    				pulumi.String("443"),
    			},
    			HttpToUserIp:  pulumi.String("Off"),
    			HttpsRedirect: pulumi.String("Off"),
    			LoadBalancing: pulumi.String("IpHash"),
    			LogHeaders: waf.DomainLogHeaderArray{
    				&waf.DomainLogHeaderArgs{
    					Key:   pulumi.String("foo"),
    					Value: pulumi.String("http"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = waf.NewProtectionModule(ctx, "default", &waf.ProtectionModuleArgs{
    			InstanceId:  pulumi.String(_default.Ids[0]),
    			Domain:      defaultDomain.DomainName,
    			DefenseType: pulumi.String("ac_cc"),
    			Mode:        pulumi.Int(0),
    			Status:      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 @default = AliCloud.Waf.GetInstances.Invoke();
    
        var defaultDomain = new AliCloud.Waf.Domain("default", new()
        {
            DomainName = "you domain",
            InstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Ids[0])),
            IsAccessProduct = "On",
            SourceIps = new[]
            {
                "1.1.1.1",
            },
            ClusterType = "PhysicalCluster",
            Http2Ports = new[]
            {
                "443",
            },
            HttpPorts = new[]
            {
                "80",
            },
            HttpsPorts = new[]
            {
                "443",
            },
            HttpToUserIp = "Off",
            HttpsRedirect = "Off",
            LoadBalancing = "IpHash",
            LogHeaders = new[]
            {
                new AliCloud.Waf.Inputs.DomainLogHeaderArgs
                {
                    Key = "foo",
                    Value = "http",
                },
            },
        });
    
        var defaultProtectionModule = new AliCloud.Waf.ProtectionModule("default", new()
        {
            InstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Ids[0])),
            Domain = defaultDomain.DomainName,
            DefenseType = "ac_cc",
            Mode = 0,
            Status = 0,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.waf.WafFunctions;
    import com.pulumi.alicloud.waf.inputs.GetInstancesArgs;
    import com.pulumi.alicloud.waf.Domain;
    import com.pulumi.alicloud.waf.DomainArgs;
    import com.pulumi.alicloud.waf.inputs.DomainLogHeaderArgs;
    import com.pulumi.alicloud.waf.ProtectionModule;
    import com.pulumi.alicloud.waf.ProtectionModuleArgs;
    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 default = WafFunctions.getInstances();
    
            var defaultDomain = new Domain("defaultDomain", DomainArgs.builder()
                .domainName("you domain")
                .instanceId(default_.ids()[0])
                .isAccessProduct("On")
                .sourceIps("1.1.1.1")
                .clusterType("PhysicalCluster")
                .http2Ports(443)
                .httpPorts(80)
                .httpsPorts(443)
                .httpToUserIp("Off")
                .httpsRedirect("Off")
                .loadBalancing("IpHash")
                .logHeaders(DomainLogHeaderArgs.builder()
                    .key("foo")
                    .value("http")
                    .build())
                .build());
    
            var defaultProtectionModule = new ProtectionModule("defaultProtectionModule", ProtectionModuleArgs.builder()
                .instanceId(default_.ids()[0])
                .domain(defaultDomain.domainName())
                .defenseType("ac_cc")
                .mode(0)
                .status(0)
                .build());
    
        }
    }
    
    resources:
      defaultDomain:
        type: alicloud:waf:Domain
        name: default
        properties:
          domainName: you domain
          instanceId: ${default.ids[0]}
          isAccessProduct: On
          sourceIps:
            - 1.1.1.1
          clusterType: PhysicalCluster
          http2Ports:
            - 443
          httpPorts:
            - 80
          httpsPorts:
            - 443
          httpToUserIp: Off
          httpsRedirect: Off
          loadBalancing: IpHash
          logHeaders:
            - key: foo
              value: http
      defaultProtectionModule:
        type: alicloud:waf:ProtectionModule
        name: default
        properties:
          instanceId: ${default.ids[0]}
          domain: ${defaultDomain.domainName}
          defenseType: ac_cc
          mode: 0
          status: 0
    variables:
      default:
        fn::invoke:
          Function: alicloud:waf:getInstances
          Arguments: {}
    

    Create ProtectionModule Resource

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

    Constructor syntax

    new ProtectionModule(name: string, args: ProtectionModuleArgs, opts?: CustomResourceOptions);
    @overload
    def ProtectionModule(resource_name: str,
                         args: ProtectionModuleArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProtectionModule(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         defense_type: Optional[str] = None,
                         domain: Optional[str] = None,
                         instance_id: Optional[str] = None,
                         mode: Optional[int] = None,
                         status: Optional[int] = None)
    func NewProtectionModule(ctx *Context, name string, args ProtectionModuleArgs, opts ...ResourceOption) (*ProtectionModule, error)
    public ProtectionModule(string name, ProtectionModuleArgs args, CustomResourceOptions? opts = null)
    public ProtectionModule(String name, ProtectionModuleArgs args)
    public ProtectionModule(String name, ProtectionModuleArgs args, CustomResourceOptions options)
    
    type: alicloud:waf:ProtectionModule
    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 ProtectionModuleArgs
    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 ProtectionModuleArgs
    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 ProtectionModuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProtectionModuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProtectionModuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

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

    var protectionModuleResource = new AliCloud.Waf.ProtectionModule("protectionModuleResource", new()
    {
        DefenseType = "string",
        Domain = "string",
        InstanceId = "string",
        Mode = 0,
        Status = 0,
    });
    
    example, err := waf.NewProtectionModule(ctx, "protectionModuleResource", &waf.ProtectionModuleArgs{
    	DefenseType: pulumi.String("string"),
    	Domain:      pulumi.String("string"),
    	InstanceId:  pulumi.String("string"),
    	Mode:        pulumi.Int(0),
    	Status:      pulumi.Int(0),
    })
    
    var protectionModuleResource = new ProtectionModule("protectionModuleResource", ProtectionModuleArgs.builder()
        .defenseType("string")
        .domain("string")
        .instanceId("string")
        .mode(0)
        .status(0)
        .build());
    
    protection_module_resource = alicloud.waf.ProtectionModule("protectionModuleResource",
        defense_type="string",
        domain="string",
        instance_id="string",
        mode=0,
        status=0)
    
    const protectionModuleResource = new alicloud.waf.ProtectionModule("protectionModuleResource", {
        defenseType: "string",
        domain: "string",
        instanceId: "string",
        mode: 0,
        status: 0,
    });
    
    type: alicloud:waf:ProtectionModule
    properties:
        defenseType: string
        domain: string
        instanceId: string
        mode: 0
        status: 0
    

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

    DefenseType string
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    Domain string
    The domain name that is added to WAF.
    InstanceId string
    The ID of the WAF instance.
    Mode int
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    Status int
    The status of the resource. Valid values: 0, 1.
    DefenseType string
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    Domain string
    The domain name that is added to WAF.
    InstanceId string
    The ID of the WAF instance.
    Mode int
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    Status int
    The status of the resource. Valid values: 0, 1.
    defenseType String
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain String
    The domain name that is added to WAF.
    instanceId String
    The ID of the WAF instance.
    mode Integer
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status Integer
    The status of the resource. Valid values: 0, 1.
    defenseType string
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain string
    The domain name that is added to WAF.
    instanceId string
    The ID of the WAF instance.
    mode number
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status number
    The status of the resource. Valid values: 0, 1.
    defense_type str
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain str
    The domain name that is added to WAF.
    instance_id str
    The ID of the WAF instance.
    mode int
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status int
    The status of the resource. Valid values: 0, 1.
    defenseType String
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain String
    The domain name that is added to WAF.
    instanceId String
    The ID of the WAF instance.
    mode Number
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status Number
    The status of the resource. Valid values: 0, 1.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProtectionModule 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 ProtectionModule Resource

    Get an existing ProtectionModule 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?: ProtectionModuleState, opts?: CustomResourceOptions): ProtectionModule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            defense_type: Optional[str] = None,
            domain: Optional[str] = None,
            instance_id: Optional[str] = None,
            mode: Optional[int] = None,
            status: Optional[int] = None) -> ProtectionModule
    func GetProtectionModule(ctx *Context, name string, id IDInput, state *ProtectionModuleState, opts ...ResourceOption) (*ProtectionModule, error)
    public static ProtectionModule Get(string name, Input<string> id, ProtectionModuleState? state, CustomResourceOptions? opts = null)
    public static ProtectionModule get(String name, Output<String> id, ProtectionModuleState 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:
    DefenseType string
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    Domain string
    The domain name that is added to WAF.
    InstanceId string
    The ID of the WAF instance.
    Mode int
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    Status int
    The status of the resource. Valid values: 0, 1.
    DefenseType string
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    Domain string
    The domain name that is added to WAF.
    InstanceId string
    The ID of the WAF instance.
    Mode int
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    Status int
    The status of the resource. Valid values: 0, 1.
    defenseType String
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain String
    The domain name that is added to WAF.
    instanceId String
    The ID of the WAF instance.
    mode Integer
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status Integer
    The status of the resource. Valid values: 0, 1.
    defenseType string
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain string
    The domain name that is added to WAF.
    instanceId string
    The ID of the WAF instance.
    mode number
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status number
    The status of the resource. Valid values: 0, 1.
    defense_type str
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain str
    The domain name that is added to WAF.
    instance_id str
    The ID of the WAF instance.
    mode int
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status int
    The status of the resource. Valid values: 0, 1.
    defenseType String
    The Protection Module. Valid values: ac_cc, antifraud, dld, normalized, waf.
    domain String
    The domain name that is added to WAF.
    instanceId String
    The ID of the WAF instance.
    mode Number
    The protection mode of the specified protection module. NOTE: The value of the Mode parameter varies based on the value of the defense_type parameter.

    • The defense_type is waf. 0: block mode. 1: warn mode.
    • The defense_type is dld. 0: warn mode. 1: block mode.
    • The defense_type is ac_cc. 0: prevention mode. 1: protection-emergency mode.
    • The defense_type is antifraud. 0: warn mode. 1: block mode. 2: strict interception mode.
    • The defense_type is normalized. 0: warn mode. 1: block mode.
    status Number
    The status of the resource. Valid values: 0, 1.

    Import

    Web Application Firewall(WAF) Protection Module can be imported using the id, e.g.

    $ pulumi import alicloud:waf/protectionModule:ProtectionModule example <instance_id>:<domain>:<defense_type>
    

    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.57.1 published on Wednesday, Jun 26, 2024 by Pulumi