Skip to content
Start here

UA Rules

resource cloudflare_user_agent_blocking_rule

required Expand Collapse
zone_id: String

Defines an identifier.

mode: String

The action to apply to a matched request.

configuration: Attributes
target?: String

The configuration target. You must set the target to ua when specifying a user agent in the rule.

value?: String

the user agent to exactly match

optional Expand Collapse
description?: String

An informative summary of the rule. This value is sanitized and any tags will be removed.

paused?: Bool

When true, indicates that the rule is currently paused.

computed Expand Collapse
id: String

The unique identifier of the User Agent Blocking rule.

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

required Expand Collapse
zone_id: String

Defines an identifier.

optional Expand Collapse
ua_rule_id?: String

The unique identifier of the User Agent Blocking rule.

filter?: Attributes
description?: String

A string to search for in the description of existing rules.

paused?: Bool

When true, indicates that the rule is currently paused.

user_agent?: String

A string to search for in the user agent values of existing rules.

computed Expand Collapse
id: String

The unique identifier of the User Agent Blocking rule.

description: String

An informative summary of the rule.

mode: String

The action to apply to a matched request.

paused: Bool

When true, indicates that the rule is currently paused.

configuration: Attributes

The configuration object for the current rule.

target: String

The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.

value: String

The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.

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

required Expand Collapse
zone_id: String

Defines an identifier.

optional Expand Collapse
description?: String

A string to search for in the description of existing rules.

paused?: Bool

When true, indicates that the rule is currently paused.

user_agent?: String

A string to search for in the user agent values of existing rules.

max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

id: String

The unique identifier of the User Agent Blocking rule.

configuration: Attributes

The configuration object for the current rule.

target: String

The configuration target for this rule. You must set the target to ua for User Agent Blocking rules.

value: String

The exact user agent string to match. This value will be compared to the received User-Agent HTTP header value.

description: String

An informative summary of the rule.

mode: String

The action to apply to a matched request.

paused: Bool

When true, indicates that the rule is currently paused.

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"
}