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

alicloud.dcdn.WafDomain

Explore with Pulumi AI

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

    Provides a DCDN Waf Domain resource.

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

    NOTE: Available since v1.185.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const domainName = config.get("domainName") || "tf-example.com";
    const _default = new random.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const example = new alicloud.dcdn.Domain("example", {
        domainName: `${domainName}-${_default.result}`,
        scope: "overseas",
        sources: [{
            content: "1.1.1.1",
            port: 80,
            priority: "20",
            type: "ipaddr",
            weight: "10",
        }],
    });
    const exampleWafDomain = new alicloud.dcdn.WafDomain("example", {
        domainName: example.domainName,
        clientIpTag: "X-Forwarded-For",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    domain_name = config.get("domainName")
    if domain_name is None:
        domain_name = "tf-example.com"
    default = random.index.Integer("default",
        min=10000,
        max=99999)
    example = alicloud.dcdn.Domain("example",
        domain_name=f"{domain_name}-{default['result']}",
        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("example",
        domain_name=example.domain_name,
        client_ip_tag="X-Forwarded-For")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dcdn"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"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, "")
    		domainName := "tf-example.com"
    		if param := cfg.Get("domainName"); param != "" {
    			domainName = param
    		}
    		_, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		example, err := dcdn.NewDomain(ctx, "example", &dcdn.DomainArgs{
    			DomainName: pulumi.String(fmt.Sprintf("%v-%v", domainName, _default.Result)),
    			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
    		}
    		_, err = dcdn.NewWafDomain(ctx, "example", &dcdn.WafDomainArgs{
    			DomainName:  example.DomainName,
    			ClientIpTag: pulumi.String("X-Forwarded-For"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var domainName = config.Get("domainName") ?? "tf-example.com";
        var @default = new Random.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var example = new AliCloud.Dcdn.Domain("example", new()
        {
            DomainName = $"{domainName}-{@default.Result}",
            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("example", new()
        {
            DomainName = example.DomainName,
            ClientIpTag = "X-Forwarded-For",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    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 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 domainName = config.get("domainName").orElse("tf-example.com");
            var default_ = new Integer("default", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            var example = new Domain("example", DomainArgs.builder()
                .domainName(String.format("%s-%s", domainName,default_.result()))
                .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(example.domainName())
                .clientIpTag("X-Forwarded-For")
                .build());
    
        }
    }
    
    configuration:
      domainName:
        type: string
        default: tf-example.com
    resources:
      default:
        type: random:integer
        properties:
          min: 10000
          max: 99999
      example:
        type: alicloud:dcdn:Domain
        properties:
          domainName: ${domainName}-${default.result}
          scope: overseas
          sources:
            - content: 1.1.1.1
              port: '80'
              priority: '20'
              type: ipaddr
              weight: '10'
      exampleWafDomain:
        type: alicloud:dcdn:WafDomain
        name: example
        properties:
          domainName: ${example.domainName}
          clientIpTag: X-Forwarded-For
    

    Create WafDomain Resource

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

    Constructor syntax

    new WafDomain(name: string, args: WafDomainArgs, opts?: CustomResourceOptions);
    @overload
    def WafDomain(resource_name: str,
                  args: WafDomainArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def WafDomain(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  domain_name: Optional[str] = None,
                  client_ip_tag: Optional[str] = None)
    func NewWafDomain(ctx *Context, name string, args WafDomainArgs, opts ...ResourceOption) (*WafDomain, error)
    public WafDomain(string name, WafDomainArgs args, CustomResourceOptions? opts = null)
    public WafDomain(String name, WafDomainArgs args)
    public WafDomain(String name, WafDomainArgs args, CustomResourceOptions options)
    
    type: alicloud:dcdn:WafDomain
    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 WafDomainArgs
    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 WafDomainArgs
    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 WafDomainArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WafDomainArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WafDomainArgs
    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 wafDomainResource = new AliCloud.Dcdn.WafDomain("wafDomainResource", new()
    {
        DomainName = "string",
        ClientIpTag = "string",
    });
    
    example, err := dcdn.NewWafDomain(ctx, "wafDomainResource", &dcdn.WafDomainArgs{
    	DomainName:  pulumi.String("string"),
    	ClientIpTag: pulumi.String("string"),
    })
    
    var wafDomainResource = new WafDomain("wafDomainResource", WafDomainArgs.builder()
        .domainName("string")
        .clientIpTag("string")
        .build());
    
    waf_domain_resource = alicloud.dcdn.WafDomain("wafDomainResource",
        domain_name="string",
        client_ip_tag="string")
    
    const wafDomainResource = new alicloud.dcdn.WafDomain("wafDomainResource", {
        domainName: "string",
        clientIpTag: "string",
    });
    
    type: alicloud:dcdn:WafDomain
    properties:
        clientIpTag: string
        domainName: string
    

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

    DomainName string
    The accelerated domain name.
    ClientIpTag string
    The client ip tag.
    DomainName string
    The accelerated domain name.
    ClientIpTag string
    The client ip tag.
    domainName String
    The accelerated domain name.
    clientIpTag String
    The client ip tag.
    domainName string
    The accelerated domain name.
    clientIpTag string
    The client ip tag.
    domain_name str
    The accelerated domain name.
    client_ip_tag str
    The client ip tag.
    domainName String
    The accelerated domain name.
    clientIpTag String
    The client ip tag.

    Outputs

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

    Get an existing WafDomain 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?: WafDomainState, opts?: CustomResourceOptions): WafDomain
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_ip_tag: Optional[str] = None,
            domain_name: Optional[str] = None) -> WafDomain
    func GetWafDomain(ctx *Context, name string, id IDInput, state *WafDomainState, opts ...ResourceOption) (*WafDomain, error)
    public static WafDomain Get(string name, Input<string> id, WafDomainState? state, CustomResourceOptions? opts = null)
    public static WafDomain get(String name, Output<String> id, WafDomainState 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:
    ClientIpTag string
    The client ip tag.
    DomainName string
    The accelerated domain name.
    ClientIpTag string
    The client ip tag.
    DomainName string
    The accelerated domain name.
    clientIpTag String
    The client ip tag.
    domainName String
    The accelerated domain name.
    clientIpTag string
    The client ip tag.
    domainName string
    The accelerated domain name.
    client_ip_tag str
    The client ip tag.
    domain_name str
    The accelerated domain name.
    clientIpTag String
    The client ip tag.
    domainName String
    The accelerated domain name.

    Import

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

    $ pulumi import alicloud:dcdn/wafDomain:WafDomain example <domain_name>
    

    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