Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

WafRule

Provides a Cloudflare WAF rule resource for a particular zone. This can be used to configure firewall behaviour for pre-defined firewall rules.

Example Usage

using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

class MyStack : Stack
{
    public MyStack()
    {
        var rule100000 = new Cloudflare.WafRule("rule100000", new Cloudflare.WafRuleArgs
        {
            Mode = "simulate",
            RuleId = "100000",
            ZoneId = "ae36f999674d196762efcc5abb06b345",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-cloudflare/sdk/v2/go/cloudflare"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := cloudflare.NewWafRule(ctx, "rule100000", &cloudflare.WafRuleArgs{
            Mode:   pulumi.String("simulate"),
            RuleId: pulumi.String("100000"),
            ZoneId: pulumi.String("ae36f999674d196762efcc5abb06b345"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_cloudflare as cloudflare

rule100000 = cloudflare.WafRule("rule100000",
    mode="simulate",
    rule_id="100000",
    zone_id="ae36f999674d196762efcc5abb06b345")
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const rule100000 = new cloudflare.WafRule("rule_100000", {
    mode: "simulate",
    ruleId: "100000",
    zoneId: "ae36f999674d196762efcc5abb06b345",
});

Create a WafRule Resource

new WafRule(name: string, args: WafRuleArgs, opts?: CustomResourceOptions);
def WafRule(resource_name: str, opts: Optional[ResourceOptions] = None, mode: Optional[str] = None, package_id: Optional[str] = None, rule_id: Optional[str] = None, zone_id: Optional[str] = None)
func NewWafRule(ctx *Context, name string, args WafRuleArgs, opts ...ResourceOption) (*WafRule, error)
public WafRule(string name, WafRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args WafRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args WafRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args WafRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

WafRule Resource Properties

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

Inputs

The WafRule resource accepts the following input properties:

Mode string

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

RuleId string

The WAF Rule ID.

ZoneId string

The DNS zone ID to apply to.

PackageId string

The ID of the WAF Rule Package that contains the rule.

Mode string

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

RuleId string

The WAF Rule ID.

ZoneId string

The DNS zone ID to apply to.

PackageId string

The ID of the WAF Rule Package that contains the rule.

mode string

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

ruleId string

The WAF Rule ID.

zoneId string

The DNS zone ID to apply to.

packageId string

The ID of the WAF Rule Package that contains the rule.

mode str

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

rule_id str

The WAF Rule ID.

zone_id str

The DNS zone ID to apply to.

package_id str

The ID of the WAF Rule Package that contains the rule.

Outputs

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

GroupId string

The ID of the WAF Rule Group that contains the rule.

Id string
The provider-assigned unique ID for this managed resource.
GroupId string

The ID of the WAF Rule Group that contains the rule.

Id string
The provider-assigned unique ID for this managed resource.
groupId string

The ID of the WAF Rule Group that contains the rule.

id string
The provider-assigned unique ID for this managed resource.
group_id str

The ID of the WAF Rule Group that contains the rule.

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing WafRule Resource

Get an existing WafRule 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?: WafRuleState, opts?: CustomResourceOptions): WafRule
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, group_id: Optional[str] = None, mode: Optional[str] = None, package_id: Optional[str] = None, rule_id: Optional[str] = None, zone_id: Optional[str] = None) -> WafRule
func GetWafRule(ctx *Context, name string, id IDInput, state *WafRuleState, opts ...ResourceOption) (*WafRule, error)
public static WafRule Get(string name, Input<string> id, WafRuleState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

GroupId string

The ID of the WAF Rule Group that contains the rule.

Mode string

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

PackageId string

The ID of the WAF Rule Package that contains the rule.

RuleId string

The WAF Rule ID.

ZoneId string

The DNS zone ID to apply to.

GroupId string

The ID of the WAF Rule Group that contains the rule.

Mode string

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

PackageId string

The ID of the WAF Rule Package that contains the rule.

RuleId string

The WAF Rule ID.

ZoneId string

The DNS zone ID to apply to.

groupId string

The ID of the WAF Rule Group that contains the rule.

mode string

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

packageId string

The ID of the WAF Rule Package that contains the rule.

ruleId string

The WAF Rule ID.

zoneId string

The DNS zone ID to apply to.

group_id str

The ID of the WAF Rule Group that contains the rule.

mode str

The mode of the rule, can be one of [“block”, “challenge”, “default”, “disable”, “simulate”] or [“on”, “off”] depending on the WAF Rule type.

package_id str

The ID of the WAF Rule Package that contains the rule.

rule_id str

The WAF Rule ID.

zone_id str

The DNS zone ID to apply to.

Import

Rules can be imported using a composite ID formed of zone ID and the WAF Rule ID, e.g.

 $ pulumi import cloudflare:index/wafRule:WafRule 100000 ae36f999674d196762efcc5abb06b345/100000

Package Details

Repository
https://github.com/pulumi/pulumi-cloudflare
License
Apache-2.0
Notes
This Pulumi package is based on the cloudflare Terraform Provider.