FirewallRuleArgs

data class FirewallRuleArgs(val action: Output<FirewallRuleActionArgs>? = null, val filter: Output<FirewallRuleFilterArgs>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<FirewallRuleArgs>

cloudflare.FirewallRule is in a deprecation phase until June 15th, 2025. During this time period, this resource is still fully supported but you are strongly advised to move to the cloudflare.Ruleset resource. Full details can be found in the developer documentation.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleFirewallRule = new cloudflare.FirewallRule("example_firewall_rule", {
zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
action: {
mode: "simulate",
response: {
body: "<error>This request has been rate-limited.</error>",
contentType: "text/xml",
},
timeout: 86400,
},
filter: {
description: "Restrict access from these browsers on this address range.",
expression: "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
paused: false,
ref: "FIL-100",
},
});
import pulumi
import pulumi_cloudflare as cloudflare
example_firewall_rule = cloudflare.FirewallRule("example_firewall_rule",
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
action={
"mode": "simulate",
"response": {
"body": "<error>This request has been rate-limited.</error>",
"content_type": "text/xml",
},
"timeout": 86400,
},
filter={
"description": "Restrict access from these browsers on this address range.",
"expression": "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
"paused": False,
"ref": "FIL-100",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var exampleFirewallRule = new Cloudflare.FirewallRule("example_firewall_rule", new()
{
ZoneId = "023e105f4ecef8ad9ca31a8372d0c353",
Action = new Cloudflare.Inputs.FirewallRuleActionArgs
{
Mode = "simulate",
Response = new Cloudflare.Inputs.FirewallRuleActionResponseArgs
{
Body = "<error>This request has been rate-limited.</error>",
ContentType = "text/xml",
},
Timeout = 86400,
},
Filter = new Cloudflare.Inputs.FirewallRuleFilterArgs
{
Description = "Restrict access from these browsers on this address range.",
Expression = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
Paused = false,
Ref = "FIL-100",
},
});
});
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.NewFirewallRule(ctx, "example_firewall_rule", &cloudflare.FirewallRuleArgs{
ZoneId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
Action: &cloudflare.FirewallRuleActionArgs{
Mode: pulumi.String("simulate"),
Response: &cloudflare.FirewallRuleActionResponseArgs{
Body: pulumi.String("<error>This request has been rate-limited.</error>"),
ContentType: pulumi.String("text/xml"),
},
Timeout: pulumi.Float64(86400),
},
Filter: &cloudflare.FirewallRuleFilterArgs{
Description: pulumi.String("Restrict access from these browsers on this address range."),
Expression: pulumi.String("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155"),
Paused: pulumi.Bool(false),
Ref: pulumi.String("FIL-100"),
},
})
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.FirewallRule;
import com.pulumi.cloudflare.FirewallRuleArgs;
import com.pulumi.cloudflare.inputs.FirewallRuleActionArgs;
import com.pulumi.cloudflare.inputs.FirewallRuleActionResponseArgs;
import com.pulumi.cloudflare.inputs.FirewallRuleFilterArgs;
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 exampleFirewallRule = new FirewallRule("exampleFirewallRule", FirewallRuleArgs.builder()
.zoneId("023e105f4ecef8ad9ca31a8372d0c353")
.action(FirewallRuleActionArgs.builder()
.mode("simulate")
.response(FirewallRuleActionResponseArgs.builder()
.body("<error>This request has been rate-limited.</error>")
.contentType("text/xml")
.build())
.timeout(86400.0)
.build())
.filter(FirewallRuleFilterArgs.builder()
.description("Restrict access from these browsers on this address range.")
.expression("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155")
.paused(false)
.ref("FIL-100")
.build())
.build());
}
}
resources:
exampleFirewallRule:
type: cloudflare:FirewallRule
name: example_firewall_rule
properties:
zoneId: 023e105f4ecef8ad9ca31a8372d0c353
action:
mode: simulate
response:
body: <error>This request has been rate-limited.</error>
contentType: text/xml
timeout: 86400
filter:
description: Restrict access from these browsers on this address range.
expression: (http.request.uri.path ~ ".*wp-login.php" or http.request.uri.path ~ ".*xmlrpc.php") and ip.addr ne 172.16.22.155
paused: false
ref: FIL-100

Import

$ pulumi import cloudflare:index/firewallRule:FirewallRule example '<zone_id>/<rule_id>'

Constructors

Link copied to clipboard
constructor(action: Output<FirewallRuleActionArgs>? = null, filter: Output<FirewallRuleFilterArgs>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard
val action: Output<FirewallRuleActionArgs>? = null

The action to perform when the threshold of matched traffic within the configured period is exceeded.

Link copied to clipboard
val filter: Output<FirewallRuleFilterArgs>? = null
Link copied to clipboard
val zoneId: Output<String>? = null

Identifier

Functions

Link copied to clipboard
open override fun toJava(): FirewallRuleArgs