alicloud.esa.WafRuleset
Explore with Pulumi AI
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:
Outputs
All input properties are implicitly available as output properties. Additionally, the WafRuleset resource produces the following output properties:
- id str
- The provider-assigned unique ID for this managed resource.
- ruleset_
id int - 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.
- 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
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.