Firewall
FirewallLockdowns
resource cloudflare_zone_lockdown
required
optional
description?: String
An informative summary of the rule. This value is sanitized and any tags will be removed.
cloudflare_zone_lockdown
resource "cloudflare_zone_lockdown" "example_zone_lockdown" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
configurations = [{
target = "ip"
value = "198.51.100.4"
}]
urls = ["shop.example.com/*"]
description = "Prevent multiple login failures to mitigate brute force attacks"
paused = false
priority = 5
}
data cloudflare_zone_lockdown
cloudflare_zone_lockdown
data "cloudflare_zone_lockdown" "example_zone_lockdown" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
lock_downs_id = "372e67954025e0ba6aaa6d586b9e0b59"
}
data cloudflare_zone_lockdowns
cloudflare_zone_lockdowns
data "cloudflare_zone_lockdowns" "example_zone_lockdowns" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
created_on = "2014-01-01T05:20:00.12345Z"
description = "endpoints"
description_search = "endpoints"
ip = "1.2.3.4"
ip_range_search = "1.2.3.0/16"
ip_search = "1.2.3.4"
modified_on = "2014-01-01T05:20:00.12345Z"
priority = 5
uri_search = "/some/path"
}
FirewallRules
resource cloudflare_firewall_rule
cloudflare_firewall_rule
resource "cloudflare_firewall_rule" "example_firewall_rule" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
action = {
mode = "challenge"
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"
}
}
data cloudflare_firewall_rule
computed
action: String
The action to apply to a matched request. The log action is only available on an Enterprise plan.
cloudflare_firewall_rule
data "cloudflare_firewall_rule" "example_firewall_rule" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
rule_id = "372e67954025e0ba6aaa6d586b9e0b60"
}
data cloudflare_firewall_rules
optional
cloudflare_firewall_rules
data "cloudflare_firewall_rules" "example_firewall_rules" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
id = "372e67954025e0ba6aaa6d586b9e0b60"
action = "block"
description = "mir"
paused = false
}
FirewallAccess Rules
resource cloudflare_access_rule
optional
cloudflare_access_rule
resource "cloudflare_access_rule" "example_access_rule" {
configuration = {
target = "ip"
value = "198.51.100.4"
}
mode = "challenge"
zone_id = "zone_id"
notes = "This rule is enabled because of an event that occurred on date X."
}
data cloudflare_access_rule
optional
computed
cloudflare_access_rule
data "cloudflare_access_rule" "example_access_rule" {
rule_id = "023e105f4ecef8ad9ca31a8372d0c353"
account_id = "account_id"
zone_id = "zone_id"
}
data cloudflare_access_rules
optional
notes?: String
Defines the string to search for in the notes of existing IP Access rules. Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.
cloudflare_access_rules
data "cloudflare_access_rules" "example_access_rules" {
account_id = "account_id"
zone_id = "zone_id"
configuration = {
target = "ip"
value = "198.51.100.4"
}
direction = "desc"
mode = "challenge"
notes = "my note"
order = "mode"
}
FirewallUA Rules
resource cloudflare_user_agent_blocking_rule
required
optional
cloudflare_user_agent_blocking_rule
resource "cloudflare_user_agent_blocking_rule" "example_user_agent_blocking_rule" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
configuration = {
target = "ua"
value = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
}
mode = "challenge"
description = "Prevent multiple login failures to mitigate brute force attacks"
paused = false
}
data cloudflare_user_agent_blocking_rule
cloudflare_user_agent_blocking_rule
data "cloudflare_user_agent_blocking_rule" "example_user_agent_blocking_rule" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
ua_rule_id = "372e67954025e0ba6aaa6d586b9e0b59"
}
data cloudflare_user_agent_blocking_rules
optional
cloudflare_user_agent_blocking_rules
data "cloudflare_user_agent_blocking_rules" "example_user_agent_blocking_rules" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
description = "abusive"
paused = false
user_agent = "Safari"
}