published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
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 System.Collections.Generic;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var shopEcxample = new Cloudflare.WafOverride("shopEcxample", new()
{
ZoneId = "1d5fdc9e88c8a8c4518b068cd94331fe",
Urls = new[]
{
"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/v4/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/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
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.WafOverride;
import com.pulumi.cloudflare.WafOverrideArgs;
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) {
var shopEcxample = new WafOverride("shopEcxample", WafOverrideArgs.builder()
.zoneId("1d5fdc9e88c8a8c4518b068cd94331fe")
.urls(
"example.com/no-waf-here",
"example.com/another/path/*")
.rules(Map.of("100015", "disable"))
.groups(Map.of("ea8687e59929c1fd05ba97574ad43f77", "default"))
.rewriteAction(Map.ofEntries(
Map.entry("default", "block"),
Map.entry("challenge", "block")
))
.build());
}
}
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",
},
});
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",
})
resources:
shopEcxample:
type: cloudflare:WafOverride
properties:
zoneId: 1d5fdc9e88c8a8c4518b068cd94331fe
urls:
- example.com/no-waf-here
- example.com/another/path/*
# Disable rule ID 100015.
rules:
'100015': disable
# Set to Cloudflare default action for group ID ea8687e59929c1fd05ba97574ad43f77.
groups:
ea8687e59929c1fd05ba97574ad43f77: default
# Update the actions for when a matching rule is encountered.
rewriteAction:
default: block
challenge: block
Create WafOverride Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new WafOverride(name: string, args: WafOverrideArgs, opts?: CustomResourceOptions);@overload
def WafOverride(resource_name: str,
args: WafOverrideArgs,
opts: Optional[ResourceOptions] = None)
@overload
def WafOverride(resource_name: str,
opts: Optional[ResourceOptions] = None,
urls: Optional[Sequence[str]] = None,
zone_id: Optional[str] = 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)func NewWafOverride(ctx *Context, name string, args WafOverrideArgs, opts ...ResourceOption) (*WafOverride, error)public WafOverride(string name, WafOverrideArgs args, CustomResourceOptions? opts = null)
public WafOverride(String name, WafOverrideArgs args)
public WafOverride(String name, WafOverrideArgs args, CustomResourceOptions options)
type: cloudflare:WafOverride
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 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.
- args WafOverrideArgs
- 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 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.
- name String
- The unique name of the resource.
- args WafOverrideArgs
- 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 wafOverrideResource = new Cloudflare.WafOverride("wafOverrideResource", new()
{
Urls = new[]
{
"string",
},
ZoneId = "string",
Description = "string",
Groups =
{
{ "string", "string" },
},
Paused = false,
Priority = 0,
RewriteAction =
{
{ "string", "string" },
},
Rules =
{
{ "string", "string" },
},
});
example, err := cloudflare.NewWafOverride(ctx, "wafOverrideResource", &cloudflare.WafOverrideArgs{
Urls: pulumi.StringArray{
pulumi.String("string"),
},
ZoneId: pulumi.String("string"),
Description: pulumi.String("string"),
Groups: pulumi.StringMap{
"string": pulumi.String("string"),
},
Paused: pulumi.Bool(false),
Priority: pulumi.Int(0),
RewriteAction: pulumi.StringMap{
"string": pulumi.String("string"),
},
Rules: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var wafOverrideResource = new WafOverride("wafOverrideResource", WafOverrideArgs.builder()
.urls("string")
.zoneId("string")
.description("string")
.groups(Map.of("string", "string"))
.paused(false)
.priority(0)
.rewriteAction(Map.of("string", "string"))
.rules(Map.of("string", "string"))
.build());
waf_override_resource = cloudflare.WafOverride("wafOverrideResource",
urls=["string"],
zone_id="string",
description="string",
groups={
"string": "string",
},
paused=False,
priority=0,
rewrite_action={
"string": "string",
},
rules={
"string": "string",
})
const wafOverrideResource = new cloudflare.WafOverride("wafOverrideResource", {
urls: ["string"],
zoneId: "string",
description: "string",
groups: {
string: "string",
},
paused: false,
priority: 0,
rewriteAction: {
string: "string",
},
rules: {
string: "string",
},
});
type: cloudflare:WafOverride
properties:
description: string
groups:
string: string
paused: false
priority: 0
rewriteAction:
string: string
rules:
string: string
urls:
- string
zoneId: string
WafOverride 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 WafOverride resource accepts the following input properties:
- Urls List<string>
- An array of URLs to apply the WAF override to.
- Zone
Id 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.
- Rewrite
Action 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 []string
- An array of URLs to apply the WAF override to.
- Zone
Id 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.
- Rewrite
Action 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 List<String>
- An array of URLs to apply the WAF override to.
- zone
Id 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 Boolean
- Whether this package is currently paused.
- priority Integer
- Relative priority of this configuration when multiple configurations match a single URL.
- rewrite
Action 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.
- zone
Id 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.
- rewrite
Action {[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 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.
- rules Mapping[str, str]
- 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.
- zone
Id 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>
- 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.
- rewrite
Action Map<String> - When a WAF rule matches, substitute its configured action for a different action specified by this definition.
- rules Map<String>
- A list of WAF rule ID to rule action you intend to apply.
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.
- Override
Id string
- Id string
- The provider-assigned unique ID for this managed resource.
- Override
Id string
- id String
- The provider-assigned unique ID for this managed resource.
- override
Id String
- id string
- The provider-assigned unique ID for this managed resource.
- override
Id string
- id str
- The provider-assigned unique ID for this managed resource.
- override_
id str
- id String
- The provider-assigned unique ID for this managed resource.
- override
Id String
Look up 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) -> WafOverridefunc 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)public static WafOverride get(String name, Output<String> id, WafOverrideState state, CustomResourceOptions options)resources: _: type: cloudflare:WafOverride 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.
- Description string
- Description of what the WAF override does.
- Groups Dictionary<string, string>
- Similar to
rules; which WAF groups you want to alter. - Override
Id string - Paused bool
- Whether this package is currently paused.
- Priority int
- Relative priority of this configuration when multiple configurations match a single URL.
- Rewrite
Action 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.
- Zone
Id 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. - Override
Id string - Paused bool
- Whether this package is currently paused.
- Priority int
- Relative priority of this configuration when multiple configurations match a single URL.
- Rewrite
Action 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.
- Zone
Id 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. - override
Id String - paused Boolean
- Whether this package is currently paused.
- priority Integer
- Relative priority of this configuration when multiple configurations match a single URL.
- rewrite
Action 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 List<String>
- An array of URLs to apply the WAF override to.
- zone
Id 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. - override
Id string - paused boolean
- Whether this package is currently paused.
- priority number
- Relative priority of this configuration when multiple configurations match a single URL.
- rewrite
Action {[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.
- zone
Id 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.
- description String
- Description of what the WAF override does.
- groups Map<String>
- Similar to
rules; which WAF groups you want to alter. - override
Id String - paused Boolean
- Whether this package is currently paused.
- priority Number
- Relative priority of this configuration when multiple configurations match a single URL.
- rewrite
Action Map<String> - When a WAF rule matches, substitute its configured action for a different action specified by this definition.
- rules Map<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.
- zone
Id String - 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflareTerraform Provider.
published on Monday, Mar 9, 2026 by Pulumi
