---
title: Filters
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/terraform)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Filters

#### resource cloudflare\_filter

##### required Expand Collapse

zone\_id: String

Defines an identifier.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20zone_id>)

<details>

<summary>

body: List\[Attributes]

</summary>

id: String

The unique identifier of the filter.

<a href="#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20body%20%3E%20(attribute)%20id">Link to this property</a>

description?: String

An informative summary of the filter.

<a href="#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20body%20%3E%20(attribute)%20description">Link to this property</a>

expression?: String

The filter expression. For more information, refer to <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/">Expressions</a>.

<a href="#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20body%20%3E%20(attribute)%20expression">Link to this property</a>

paused?: Bool

When true, indicates that the filter is currently paused.

<a href="#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20body%20%3E%20(attribute)%20paused">Link to this property</a>

ref?: String

A short reference tag. Allows you to select related filters.

<a href="#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20body%20%3E%20(attribute)%20ref">Link to this property</a>

</details>

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20body>)

##### optional Expand Collapse

description?: String

An informative summary of the filter.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20description>)

expression?: String

The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20expression>)

paused?: Bool

When true, indicates that the filter is currently paused.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20paused>)

ref?: String

A short reference tag. Allows you to select related filters.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20ref>)

##### computed Expand Collapse

id: String

The unique identifier of the filter.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20id>)

### cloudflare\_filter

Terraform

HTTPTypeScriptPythonGoTerraform

```
resource "cloudflare_filter" "example_filter" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  body = [{
    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\_filter

##### required Expand Collapse

zone\_id: String

Defines an identifier.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20zone_id>)

##### optional Expand Collapse

filter\_id?: String

The unique identifier of the filter.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter_id>)

<details>

<summary>

filter?: Attributes

</summary>

id?: String

The unique identifier of the filter.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20id">Link to this property</a>

description?: String

A case-insensitive string to find in the description.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20description">Link to this property</a>

expression?: String

A case-insensitive string to find in the expression.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20expression">Link to this property</a>

paused?: Bool

When true, indicates that the filter is currently paused.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20paused">Link to this property</a>

ref?: String

The filter ref (a short reference tag) to search for. Must be an exact match.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter%20%3E%20(attribute)%20ref">Link to this property</a>

</details>

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20filter>)

##### computed Expand Collapse

id: String

The unique identifier of the filter.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20id>)

description: String

An informative summary of the filter.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20description>)

expression: String

The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20expression>)

paused: Bool

When true, indicates that the filter is currently paused.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20paused>)

ref: String

A short reference tag. Allows you to select related filters.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20ref>)

### cloudflare\_filter

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_filter" "example_filter" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  filter_id = "372e67954025e0ba6aaa6d586b9e0b61"
}
```

#### data cloudflare\_filters

##### required Expand Collapse

zone\_id: String

Defines an identifier.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20zone_id>)

##### optional Expand Collapse

description?: String

A case-insensitive string to find in the description.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20description>)

expression?: String

A case-insensitive string to find in the expression.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20expression>)

id?: String

The unique identifier of the filter.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20id>)

paused?: Bool

When true, indicates that the filter is currently paused.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20paused>)

ref?: String

The filter ref (a short reference tag) to search for. Must be an exact match.

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20ref>)

max\_items?: Int64

Max items to fetch, default: 1000

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20max_items>)

##### computed Expand Collapse

<details>

<summary>

result: List\[Attributes]

The items returned by the data source

</summary>

id: String

The unique identifier of the filter.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20id">Link to this property</a>

description: String

An informative summary of the filter.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20description">Link to this property</a>

expression: String

The filter expression. For more information, refer to <a href="https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/">Expressions</a>.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20expression">Link to this property</a>

paused: Bool

When true, indicates that the filter is currently paused.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20paused">Link to this property</a>

ref: String

A short reference tag. Allows you to select related filters.

<a href="#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result%20%3E%20(attribute)%20ref">Link to this property</a>

</details>

[Link to this property](<#(resource)%20filters%20%3E%20(terraform%20datasource-plural)%20%3E%20(attribute)%20result>)

### cloudflare\_filters

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_filters" "example_filters" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  id = "372e67954025e0ba6aaa6d586b9e0b61"
  description = "browsers"
  expression = "php"
  paused = false
  ref = "FIL-100"
}
```