1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. dcdn
  5. WafPolicyDomainAttachment
Alibaba Cloud v3.45.0 published on Monday, Nov 27, 2023 by Pulumi

alicloud.dcdn.WafPolicyDomainAttachment

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.45.0 published on Monday, Nov 27, 2023 by Pulumi

    Provides a DCDN Waf Policy Domain Attachment resource.

    For information about DCDN Waf Policy Domain Attachment and how to use it, see What is Waf Policy Domain Attachment.

    NOTE: Available since v1.186.0.

    Example Usage

    Basic Usage

    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 domainName = config.Get("domainName") ?? "example.com";
        var exampleDomain = new AliCloud.Dcdn.Domain("exampleDomain", new()
        {
            DomainName = domainName,
            Scope = "overseas",
            Sources = new[]
            {
                new AliCloud.Dcdn.Inputs.DomainSourceArgs
                {
                    Content = "1.1.1.1",
                    Port = 80,
                    Priority = "20",
                    Type = "ipaddr",
                    Weight = "10",
                },
            },
        });
    
        var exampleWafDomain = new AliCloud.Dcdn.WafDomain("exampleWafDomain", new()
        {
            DomainName = exampleDomain.DomainName,
            ClientIpTag = "X-Forwarded-For",
        });
    
        var exampleWafPolicy = new AliCloud.Dcdn.WafPolicy("exampleWafPolicy", new()
        {
            DefenseScene = "waf_group",
            PolicyName = name,
            PolicyType = "custom",
            Status = "on",
        });
    
        var exampleWafPolicyDomainAttachment = new AliCloud.Dcdn.WafPolicyDomainAttachment("exampleWafPolicyDomainAttachment", new()
        {
            DomainName = exampleWafDomain.DomainName,
            PolicyId = exampleWafPolicy.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dcdn"
    	"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
    		}
    		domainName := "example.com"
    		if param := cfg.Get("domainName"); param != "" {
    			domainName = param
    		}
    		exampleDomain, err := dcdn.NewDomain(ctx, "exampleDomain", &dcdn.DomainArgs{
    			DomainName: pulumi.String(domainName),
    			Scope:      pulumi.String("overseas"),
    			Sources: dcdn.DomainSourceArray{
    				&dcdn.DomainSourceArgs{
    					Content:  pulumi.String("1.1.1.1"),
    					Port:     pulumi.Int(80),
    					Priority: pulumi.String("20"),
    					Type:     pulumi.String("ipaddr"),
    					Weight:   pulumi.String("10"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleWafDomain, err := dcdn.NewWafDomain(ctx, "exampleWafDomain", &dcdn.WafDomainArgs{
    			DomainName:  exampleDomain.DomainName,
    			ClientIpTag: pulumi.String("X-Forwarded-For"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleWafPolicy, err := dcdn.NewWafPolicy(ctx, "exampleWafPolicy", &dcdn.WafPolicyArgs{
    			DefenseScene: pulumi.String("waf_group"),
    			PolicyName:   pulumi.String(name),
    			PolicyType:   pulumi.String("custom"),
    			Status:       pulumi.String("on"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dcdn.NewWafPolicyDomainAttachment(ctx, "exampleWafPolicyDomainAttachment", &dcdn.WafPolicyDomainAttachmentArgs{
    			DomainName: exampleWafDomain.DomainName,
    			PolicyId:   exampleWafPolicy.ID(),
    		})
    		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.dcdn.Domain;
    import com.pulumi.alicloud.dcdn.DomainArgs;
    import com.pulumi.alicloud.dcdn.inputs.DomainSourceArgs;
    import com.pulumi.alicloud.dcdn.WafDomain;
    import com.pulumi.alicloud.dcdn.WafDomainArgs;
    import com.pulumi.alicloud.dcdn.WafPolicy;
    import com.pulumi.alicloud.dcdn.WafPolicyArgs;
    import com.pulumi.alicloud.dcdn.WafPolicyDomainAttachment;
    import com.pulumi.alicloud.dcdn.WafPolicyDomainAttachmentArgs;
    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 domainName = config.get("domainName").orElse("example.com");
            var exampleDomain = new Domain("exampleDomain", DomainArgs.builder()        
                .domainName(domainName)
                .scope("overseas")
                .sources(DomainSourceArgs.builder()
                    .content("1.1.1.1")
                    .port("80")
                    .priority("20")
                    .type("ipaddr")
                    .weight("10")
                    .build())
                .build());
    
            var exampleWafDomain = new WafDomain("exampleWafDomain", WafDomainArgs.builder()        
                .domainName(exampleDomain.domainName())
                .clientIpTag("X-Forwarded-For")
                .build());
    
            var exampleWafPolicy = new WafPolicy("exampleWafPolicy", WafPolicyArgs.builder()        
                .defenseScene("waf_group")
                .policyName(name)
                .policyType("custom")
                .status("on")
                .build());
    
            var exampleWafPolicyDomainAttachment = new WafPolicyDomainAttachment("exampleWafPolicyDomainAttachment", WafPolicyDomainAttachmentArgs.builder()        
                .domainName(exampleWafDomain.domainName())
                .policyId(exampleWafPolicy.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf_example"
    domain_name = config.get("domainName")
    if domain_name is None:
        domain_name = "example.com"
    example_domain = alicloud.dcdn.Domain("exampleDomain",
        domain_name=domain_name,
        scope="overseas",
        sources=[alicloud.dcdn.DomainSourceArgs(
            content="1.1.1.1",
            port=80,
            priority="20",
            type="ipaddr",
            weight="10",
        )])
    example_waf_domain = alicloud.dcdn.WafDomain("exampleWafDomain",
        domain_name=example_domain.domain_name,
        client_ip_tag="X-Forwarded-For")
    example_waf_policy = alicloud.dcdn.WafPolicy("exampleWafPolicy",
        defense_scene="waf_group",
        policy_name=name,
        policy_type="custom",
        status="on")
    example_waf_policy_domain_attachment = alicloud.dcdn.WafPolicyDomainAttachment("exampleWafPolicyDomainAttachment",
        domain_name=example_waf_domain.domain_name,
        policy_id=example_waf_policy.id)
    
    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 domainName = config.get("domainName") || "example.com";
    const exampleDomain = new alicloud.dcdn.Domain("exampleDomain", {
        domainName: domainName,
        scope: "overseas",
        sources: [{
            content: "1.1.1.1",
            port: 80,
            priority: "20",
            type: "ipaddr",
            weight: "10",
        }],
    });
    const exampleWafDomain = new alicloud.dcdn.WafDomain("exampleWafDomain", {
        domainName: exampleDomain.domainName,
        clientIpTag: "X-Forwarded-For",
    });
    const exampleWafPolicy = new alicloud.dcdn.WafPolicy("exampleWafPolicy", {
        defenseScene: "waf_group",
        policyName: name,
        policyType: "custom",
        status: "on",
    });
    const exampleWafPolicyDomainAttachment = new alicloud.dcdn.WafPolicyDomainAttachment("exampleWafPolicyDomainAttachment", {
        domainName: exampleWafDomain.domainName,
        policyId: exampleWafPolicy.id,
    });
    
    configuration:
      name:
        type: string
        default: tf_example
      domainName:
        type: string
        default: example.com
    resources:
      exampleDomain:
        type: alicloud:dcdn:Domain
        properties:
          domainName: ${domainName}
          scope: overseas
          sources:
            - content: 1.1.1.1
              port: '80'
              priority: '20'
              type: ipaddr
              weight: '10'
      exampleWafDomain:
        type: alicloud:dcdn:WafDomain
        properties:
          domainName: ${exampleDomain.domainName}
          clientIpTag: X-Forwarded-For
      exampleWafPolicy:
        type: alicloud:dcdn:WafPolicy
        properties:
          defenseScene: waf_group
          policyName: ${name}
          policyType: custom
          status: on
      exampleWafPolicyDomainAttachment:
        type: alicloud:dcdn:WafPolicyDomainAttachment
        properties:
          domainName: ${exampleWafDomain.domainName}
          policyId: ${exampleWafPolicy.id}
    

    Create WafPolicyDomainAttachment Resource

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

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

    DomainName string

    Access the accelerated domain name of the specified protection policy.

    PolicyId string

    The protection policy ID. Only one input is supported.

    DomainName string

    Access the accelerated domain name of the specified protection policy.

    PolicyId string

    The protection policy ID. Only one input is supported.

    domainName String

    Access the accelerated domain name of the specified protection policy.

    policyId String

    The protection policy ID. Only one input is supported.

    domainName string

    Access the accelerated domain name of the specified protection policy.

    policyId string

    The protection policy ID. Only one input is supported.

    domain_name str

    Access the accelerated domain name of the specified protection policy.

    policy_id str

    The protection policy ID. Only one input is supported.

    domainName String

    Access the accelerated domain name of the specified protection policy.

    policyId String

    The protection policy ID. Only one input is supported.

    Outputs

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

    Get an existing WafPolicyDomainAttachment 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?: WafPolicyDomainAttachmentState, opts?: CustomResourceOptions): WafPolicyDomainAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            domain_name: Optional[str] = None,
            policy_id: Optional[str] = None) -> WafPolicyDomainAttachment
    func GetWafPolicyDomainAttachment(ctx *Context, name string, id IDInput, state *WafPolicyDomainAttachmentState, opts ...ResourceOption) (*WafPolicyDomainAttachment, error)
    public static WafPolicyDomainAttachment Get(string name, Input<string> id, WafPolicyDomainAttachmentState? state, CustomResourceOptions? opts = null)
    public static WafPolicyDomainAttachment get(String name, Output<String> id, WafPolicyDomainAttachmentState 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:
    DomainName string

    Access the accelerated domain name of the specified protection policy.

    PolicyId string

    The protection policy ID. Only one input is supported.

    DomainName string

    Access the accelerated domain name of the specified protection policy.

    PolicyId string

    The protection policy ID. Only one input is supported.

    domainName String

    Access the accelerated domain name of the specified protection policy.

    policyId String

    The protection policy ID. Only one input is supported.

    domainName string

    Access the accelerated domain name of the specified protection policy.

    policyId string

    The protection policy ID. Only one input is supported.

    domain_name str

    Access the accelerated domain name of the specified protection policy.

    policy_id str

    The protection policy ID. Only one input is supported.

    domainName String

    Access the accelerated domain name of the specified protection policy.

    policyId String

    The protection policy ID. Only one input is supported.

    Import

    DCDN Waf Policy Domain Attachment can be imported using the id, e.g.

     $ pulumi import alicloud:dcdn/wafPolicyDomainAttachment:WafPolicyDomainAttachment example policy_id:domain_name
    

    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.45.0 published on Monday, Nov 27, 2023 by Pulumi