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

WafOverride

Provides a Cloudflare WAF override resource. This enables the ability to toggle WAF rules and groups on or off based on URIs.

Example Usage

using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

class MyStack : Stack
{
    public MyStack()
    {
        var shopEcxample = new Cloudflare.WafOverride("shopEcxample", new Cloudflare.WafOverrideArgs
        {
            ZoneId = "1d5fdc9e88c8a8c4518b068cd94331fe",
            Urls = 
            {
                "example.com/no-waf-here",
                "example.com/another/path/*",
            },
            Rules = 
            {
                { "100015", "disable" },
            },
            Groups = 
            {
                { "ea8687e59929c1fd05ba97574ad43f77", "default" },
            },
            RewriteAction = 
            {
                { "default", "block" },
                { "challenge", "block" },
            },
        });
    }

}
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.NewWafOverride(ctx, "shopEcxample", &cloudflare.WafOverrideArgs{
            ZoneId: pulumi.String("1d5fdc9e88c8a8c4518b068cd94331fe"),
            Urls: pulumi.StringArray{
                pulumi.String("example.com/no-waf-here"),
                pulumi.String("example.com/another/path/*"),
            },
            Rules: pulumi.StringMap{
                "100015": pulumi.String("disable"),
            },
            Groups: pulumi.StringMap{
                "ea8687e59929c1fd05ba97574ad43f77": pulumi.String("default"),
            },
            RewriteAction: pulumi.StringMap{
                "default":   pulumi.String("block"),
                "challenge": pulumi.String("block"),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_cloudflare as cloudflare

shop_ecxample = cloudflare.WafOverride("shopEcxample",
    zone_id="1d5fdc9e88c8a8c4518b068cd94331fe",
    urls=[
        "example.com/no-waf-here",
        "example.com/another/path/*",
    ],
    rules={
        "100015": "disable",
    },
    groups={
        "ea8687e59929c1fd05ba97574ad43f77": "default",
    },
    rewrite_action={
        "default": "block",
        "challenge": "block",
    })
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const shopEcxample = new cloudflare.WafOverride("shopEcxample", {
    zoneId: "1d5fdc9e88c8a8c4518b068cd94331fe",
    urls: [
        "example.com/no-waf-here",
        "example.com/another/path/*",
    ],
    rules: {
        "100015": "disable",
    },
    groups: {
        ea8687e59929c1fd05ba97574ad43f77: "default",
    },
    rewriteAction: {
        "default": "block",
        challenge: "block",
    },
});

Create a WafOverride Resource

new WafOverride(name: string, args: WafOverrideArgs, opts?: CustomResourceOptions);
def WafOverride(resource_name: str, opts: Optional[ResourceOptions] = None, description: Optional[str] = None, groups: Optional[Mapping[str, str]] = None, paused: Optional[bool] = None, priority: Optional[int] = None, rewrite_action: Optional[Mapping[str, str]] = None, rules: Optional[Mapping[str, str]] = None, urls: Optional[Sequence[str]] = None, zone_id: Optional[str] = None)
func NewWafOverride(ctx *Context, name string, args WafOverrideArgs, opts ...ResourceOption) (*WafOverride, error)
public WafOverride(string name, WafOverrideArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args WafOverrideArgs
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 WafOverrideArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args WafOverrideArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

WafOverride Resource Properties

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

Inputs

The WafOverride resource accepts the following input properties:

Rules Dictionary<string, string>

A list of WAF rule ID to rule action you intend to apply.

Urls List<string>

An array of URLs to apply the WAF override to.

ZoneId string

The DNS zone to which the WAF override condition should be added.

Description string

Description of what the WAF override does.

Groups Dictionary<string, string>

Similar to rules; which WAF groups you want to alter.

Paused bool

Whether this package is currently paused.

Priority int

Relative priority of this configuration when multiple configurations match a single URL.

RewriteAction Dictionary<string, string>

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

Rules map[string]string

A list of WAF rule ID to rule action you intend to apply.

Urls []string

An array of URLs to apply the WAF override to.

ZoneId string

The DNS zone to which the WAF override condition should be added.

Description string

Description of what the WAF override does.

Groups map[string]string

Similar to rules; which WAF groups you want to alter.

Paused bool

Whether this package is currently paused.

Priority int

Relative priority of this configuration when multiple configurations match a single URL.

RewriteAction map[string]string

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

rules {[key: string]: string}

A list of WAF rule ID to rule action you intend to apply.

urls string[]

An array of URLs to apply the WAF override to.

zoneId string

The DNS zone to which the WAF override condition should be added.

description string

Description of what the WAF override does.

groups {[key: string]: string}

Similar to rules; which WAF groups you want to alter.

paused boolean

Whether this package is currently paused.

priority number

Relative priority of this configuration when multiple configurations match a single URL.

rewriteAction {[key: string]: string}

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

rules Mapping[str, str]

A list of WAF rule ID to rule action you intend to apply.

urls Sequence[str]

An array of URLs to apply the WAF override to.

zone_id str

The DNS zone to which the WAF override condition should be added.

description str

Description of what the WAF override does.

groups Mapping[str, str]

Similar to rules; which WAF groups you want to alter.

paused bool

Whether this package is currently paused.

priority int

Relative priority of this configuration when multiple configurations match a single URL.

rewrite_action Mapping[str, str]

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
OverrideId string
Id string
The provider-assigned unique ID for this managed resource.
OverrideId string
id string
The provider-assigned unique ID for this managed resource.
overrideId string
id str
The provider-assigned unique ID for this managed resource.
override_id str

Look up an Existing WafOverride Resource

Get an existing WafOverride 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?: WafOverrideState, opts?: CustomResourceOptions): WafOverride
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, description: Optional[str] = None, groups: Optional[Mapping[str, str]] = None, override_id: Optional[str] = None, paused: Optional[bool] = None, priority: Optional[int] = None, rewrite_action: Optional[Mapping[str, str]] = None, rules: Optional[Mapping[str, str]] = None, urls: Optional[Sequence[str]] = None, zone_id: Optional[str] = None) -> WafOverride
func GetWafOverride(ctx *Context, name string, id IDInput, state *WafOverrideState, opts ...ResourceOption) (*WafOverride, error)
public static WafOverride Get(string name, Input<string> id, WafOverrideState? 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:

Description string

Description of what the WAF override does.

Groups Dictionary<string, string>

Similar to rules; which WAF groups you want to alter.

OverrideId string
Paused bool

Whether this package is currently paused.

Priority int

Relative priority of this configuration when multiple configurations match a single URL.

RewriteAction Dictionary<string, string>

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

Rules Dictionary<string, string>

A list of WAF rule ID to rule action you intend to apply.

Urls List<string>

An array of URLs to apply the WAF override to.

ZoneId string

The DNS zone to which the WAF override condition should be added.

Description string

Description of what the WAF override does.

Groups map[string]string

Similar to rules; which WAF groups you want to alter.

OverrideId string
Paused bool

Whether this package is currently paused.

Priority int

Relative priority of this configuration when multiple configurations match a single URL.

RewriteAction map[string]string

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

Rules map[string]string

A list of WAF rule ID to rule action you intend to apply.

Urls []string

An array of URLs to apply the WAF override to.

ZoneId string

The DNS zone to which the WAF override condition should be added.

description string

Description of what the WAF override does.

groups {[key: string]: string}

Similar to rules; which WAF groups you want to alter.

overrideId string
paused boolean

Whether this package is currently paused.

priority number

Relative priority of this configuration when multiple configurations match a single URL.

rewriteAction {[key: string]: string}

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

rules {[key: string]: string}

A list of WAF rule ID to rule action you intend to apply.

urls string[]

An array of URLs to apply the WAF override to.

zoneId string

The DNS zone to which the WAF override condition should be added.

description str

Description of what the WAF override does.

groups Mapping[str, str]

Similar to rules; which WAF groups you want to alter.

override_id str
paused bool

Whether this package is currently paused.

priority int

Relative priority of this configuration when multiple configurations match a single URL.

rewrite_action Mapping[str, str]

When a WAF rule matches, substitute its configured action for a different action specified by this definition.

rules Mapping[str, str]

A list of WAF rule ID to rule action you intend to apply.

urls Sequence[str]

An array of URLs to apply the WAF override to.

zone_id str

The DNS zone to which the WAF override condition should be added.

Import

WAF Overrides can be imported using a composite ID formed of zone ID and override ID.

 $ pulumi import cloudflare:index/wafOverride:WafOverride my_example_waf_override 3abe5b950053dbddf1516d89f9ef1e8a/9d4e66d7649c178663bf62e06dbacb23

Package Details

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