Skip to main content

firewall_rules

Creates, updates, deletes, gets or lists a firewall_rules resource.

Overview

Namefirewall_rules
TypeResource
Idcloudflare.firewall.firewall_rules

Fields

The following fields are returned by SELECT queries:

Get a firewall rule response

NameDatatypeDescription
idstringThe unique identifier of the firewall rule. (example: 372e67954025e0ba6aaa6d586b9e0b60)
actionstringThe action to apply to a matched request. The log action is only available on an Enterprise plan. (block, challenge, js_challenge, managed_challenge, allow, log, bypass) (example: block)
descriptionstringAn informative summary of the firewall rule. (example: Blocks traffic identified during investigation for MIR-31)
filterobject
pausedbooleanWhen true, indicates that the firewall rule is currently paused.
prioritynumberThe priority of the rule. Optional value used to define the processing order. A lower number indicates a higher priority. If not provided, rules with a defined priority will be processed before rules without a priority.
productsarray
refstringA short reference tag. Allows you to select related firewall rules. (example: MIR-31)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_zoneselectrule_id, zone_idFetches the details of a firewall rule.
list_by_zoneselectzone_iddescription, action, page, per_page, id, pausedFetches firewall rules in a zone. You can filter the results using several optional parameters.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
rule_idstringThe rule ID.
zone_idstringThe Cloudflare zone ID.
actionstring
descriptionstring
idstring
pagenumber
pausedboolean
per_pagenumber

SELECT examples

Fetches the details of a firewall rule.

SELECT
id,
action,
description,
filter,
paused,
priority,
products,
ref
FROM cloudflare.firewall.firewall_rules
WHERE rule_id = '{{ rule_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;