1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. esa
  5. WafRuleset
Alibaba Cloud v3.86.0 published on Saturday, Sep 20, 2025 by Pulumi

alicloud.esa.WafRuleset

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.86.0 published on Saturday, Sep 20, 2025 by Pulumi

    Provides a ESA Waf Ruleset resource.

    waf rule set.

    For information about ESA Waf Ruleset and how to use it, see What is Waf Ruleset.

    NOTE: Available since v1.260.0.

    Example Usage

    Basic Usage

    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 _default = alicloud.esa.getSites({
        planSubscribeType: "enterpriseplan",
    });
    const defaultWafRuleset = new alicloud.esa.WafRuleset("default", {
        siteId: _default.then(_default => _default.sites?.[0]?.siteId),
        phase: "http_custom",
        siteVersion: 0,
        name: name,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.esa.get_sites(plan_subscribe_type="enterpriseplan")
    default_waf_ruleset = alicloud.esa.WafRuleset("default",
        site_id=default.sites[0].site_id,
        phase="http_custom",
        site_version=0,
        name=name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/esa"
    	"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
    		}
    		_default, err := esa.GetSites(ctx, &esa.GetSitesArgs{
    			PlanSubscribeType: pulumi.StringRef("enterpriseplan"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = esa.NewWafRuleset(ctx, "default", &esa.WafRulesetArgs{
    			SiteId:      pulumi.Int(_default.Sites[0].SiteId),
    			Phase:       pulumi.String("http_custom"),
    			SiteVersion: pulumi.Int(0),
    			Name:        pulumi.String(name),
    		})
    		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 config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.Esa.GetSites.Invoke(new()
        {
            PlanSubscribeType = "enterpriseplan",
        });
    
        var defaultWafRuleset = new AliCloud.Esa.WafRuleset("default", new()
        {
            SiteId = @default.Apply(@default => @default.Apply(getSitesResult => getSitesResult.Sites[0]?.SiteId)),
            Phase = "http_custom",
            SiteVersion = 0,
            Name = name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.esa.EsaFunctions;
    import com.pulumi.alicloud.esa.inputs.GetSitesArgs;
    import com.pulumi.alicloud.esa.WafRuleset;
    import com.pulumi.alicloud.esa.WafRulesetArgs;
    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 default = EsaFunctions.getSites(GetSitesArgs.builder()
                .planSubscribeType("enterpriseplan")
                .build());
    
            var defaultWafRuleset = new WafRuleset("defaultWafRuleset", WafRulesetArgs.builder()
                .siteId(default_.sites()[0].siteId())
                .phase("http_custom")
                .siteVersion(0)
                .name(name)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultWafRuleset:
        type: alicloud:esa:WafRuleset
        name: default
        properties:
          siteId: ${default.sites[0].siteId}
          phase: http_custom
          siteVersion: '0'
          name: ${name}
    variables:
      default:
        fn::invoke:
          function: alicloud:esa:getSites
          arguments:
            planSubscribeType: enterpriseplan
    

    Create WafRuleset Resource

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

    Constructor syntax

    new WafRuleset(name: string, args: WafRulesetArgs, opts?: CustomResourceOptions);
    @overload
    def WafRuleset(resource_name: str,
                   args: WafRulesetArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def WafRuleset(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   phase: Optional[str] = None,
                   site_id: Optional[int] = None,
                   name: Optional[str] = None,
                   site_version: Optional[int] = None,
                   status: Optional[str] = None)
    func NewWafRuleset(ctx *Context, name string, args WafRulesetArgs, opts ...ResourceOption) (*WafRuleset, error)
    public WafRuleset(string name, WafRulesetArgs args, CustomResourceOptions? opts = null)
    public WafRuleset(String name, WafRulesetArgs args)
    public WafRuleset(String name, WafRulesetArgs args, CustomResourceOptions options)
    
    type: alicloud:esa:WafRuleset
    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 WafRulesetArgs
    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 WafRulesetArgs
    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 WafRulesetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WafRulesetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WafRulesetArgs
    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 wafRulesetResource = new AliCloud.Esa.WafRuleset("wafRulesetResource", new()
    {
        Phase = "string",
        SiteId = 0,
        Name = "string",
        SiteVersion = 0,
        Status = "string",
    });
    
    example, err := esa.NewWafRuleset(ctx, "wafRulesetResource", &esa.WafRulesetArgs{
    	Phase:       pulumi.String("string"),
    	SiteId:      pulumi.Int(0),
    	Name:        pulumi.String("string"),
    	SiteVersion: pulumi.Int(0),
    	Status:      pulumi.String("string"),
    })
    
    var wafRulesetResource = new WafRuleset("wafRulesetResource", WafRulesetArgs.builder()
        .phase("string")
        .siteId(0)
        .name("string")
        .siteVersion(0)
        .status("string")
        .build());
    
    waf_ruleset_resource = alicloud.esa.WafRuleset("wafRulesetResource",
        phase="string",
        site_id=0,
        name="string",
        site_version=0,
        status="string")
    
    const wafRulesetResource = new alicloud.esa.WafRuleset("wafRulesetResource", {
        phase: "string",
        siteId: 0,
        name: "string",
        siteVersion: 0,
        status: "string",
    });
    
    type: alicloud:esa:WafRuleset
    properties:
        name: string
        phase: string
        siteId: 0
        siteVersion: 0
        status: string
    

    WafRuleset Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The WafRuleset resource accepts the following input properties:

    Phase string
    The WAF phase
    SiteId int
    The website ID, which can be obtained by calling the ListSites operation.
    Name string
    The ruleset name.
    SiteVersion int
    The site version.
    Status string
    Rule Set Status
    Phase string
    The WAF phase
    SiteId int
    The website ID, which can be obtained by calling the ListSites operation.
    Name string
    The ruleset name.
    SiteVersion int
    The site version.
    Status string
    Rule Set Status
    phase String
    The WAF phase
    siteId Integer
    The website ID, which can be obtained by calling the ListSites operation.
    name String
    The ruleset name.
    siteVersion Integer
    The site version.
    status String
    Rule Set Status
    phase string
    The WAF phase
    siteId number
    The website ID, which can be obtained by calling the ListSites operation.
    name string
    The ruleset name.
    siteVersion number
    The site version.
    status string
    Rule Set Status
    phase str
    The WAF phase
    site_id int
    The website ID, which can be obtained by calling the ListSites operation.
    name str
    The ruleset name.
    site_version int
    The site version.
    status str
    Rule Set Status
    phase String
    The WAF phase
    siteId Number
    The website ID, which can be obtained by calling the ListSites operation.
    name String
    The ruleset name.
    siteVersion Number
    The site version.
    status String
    Rule Set Status

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    RulesetId int
    waf rule set id
    Id string
    The provider-assigned unique ID for this managed resource.
    RulesetId int
    waf rule set id
    id String
    The provider-assigned unique ID for this managed resource.
    rulesetId Integer
    waf rule set id
    id string
    The provider-assigned unique ID for this managed resource.
    rulesetId number
    waf rule set id
    id str
    The provider-assigned unique ID for this managed resource.
    ruleset_id int
    waf rule set id
    id String
    The provider-assigned unique ID for this managed resource.
    rulesetId Number
    waf rule set id

    Look up Existing WafRuleset Resource

    Get an existing WafRuleset 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?: WafRulesetState, opts?: CustomResourceOptions): WafRuleset
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            phase: Optional[str] = None,
            ruleset_id: Optional[int] = None,
            site_id: Optional[int] = None,
            site_version: Optional[int] = None,
            status: Optional[str] = None) -> WafRuleset
    func GetWafRuleset(ctx *Context, name string, id IDInput, state *WafRulesetState, opts ...ResourceOption) (*WafRuleset, error)
    public static WafRuleset Get(string name, Input<string> id, WafRulesetState? state, CustomResourceOptions? opts = null)
    public static WafRuleset get(String name, Output<String> id, WafRulesetState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:esa:WafRuleset    get:      id: ${id}
    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:
    Name string
    The ruleset name.
    Phase string
    The WAF phase
    RulesetId int
    waf rule set id
    SiteId int
    The website ID, which can be obtained by calling the ListSites operation.
    SiteVersion int
    The site version.
    Status string
    Rule Set Status
    Name string
    The ruleset name.
    Phase string
    The WAF phase
    RulesetId int
    waf rule set id
    SiteId int
    The website ID, which can be obtained by calling the ListSites operation.
    SiteVersion int
    The site version.
    Status string
    Rule Set Status
    name String
    The ruleset name.
    phase String
    The WAF phase
    rulesetId Integer
    waf rule set id
    siteId Integer
    The website ID, which can be obtained by calling the ListSites operation.
    siteVersion Integer
    The site version.
    status String
    Rule Set Status
    name string
    The ruleset name.
    phase string
    The WAF phase
    rulesetId number
    waf rule set id
    siteId number
    The website ID, which can be obtained by calling the ListSites operation.
    siteVersion number
    The site version.
    status string
    Rule Set Status
    name str
    The ruleset name.
    phase str
    The WAF phase
    ruleset_id int
    waf rule set id
    site_id int
    The website ID, which can be obtained by calling the ListSites operation.
    site_version int
    The site version.
    status str
    Rule Set Status
    name String
    The ruleset name.
    phase String
    The WAF phase
    rulesetId Number
    waf rule set id
    siteId Number
    The website ID, which can be obtained by calling the ListSites operation.
    siteVersion Number
    The site version.
    status String
    Rule Set Status

    Import

    ESA Waf Ruleset can be imported using the id, e.g.

    $ pulumi import alicloud:esa/wafRuleset:WafRuleset example <ruleset_id>:<site_id>
    

    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.86.0 published on Saturday, Sep 20, 2025 by Pulumi