---
title: Page Rules
---

[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**

# Page Rules

#### resource cloudflare\_page\_rule

##### required Expand Collapse

zone\_id: String

Identifier.

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

<details>

<summary>

actions: List\[Attributes]

The set of actions to perform if the targets of this rule match the request. Actions can redirect to another URL or override settings, but not both.

</summary>

id?: String

If enabled, any <code>http://`` URL is converted to</code> https://\` through a 301 redirect.

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

value?: String

The status of Automatic HTTPS Rewrites.

<a href="#(resource)%20page_rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20actions%20%3E%20(attribute)%20value">Link to this property</a>

</details>

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

<details>

<summary>

targets: List\[Attributes]

The rule targets to evaluate on each request.

</summary>

<details>

<summary>

constraint?: Attributes

String constraint.

</summary>

operator?: String

The matches operator can use asterisks and pipes as wildcard and ‘or’ operators.

<a href="#(resource)%20page_rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20targets%20%3E%20(attribute)%20constraint%20%3E%20(attribute)%20operator">Link to this property</a>

value: String

The URL pattern to match against the current request. The pattern may contain up to four asterisks (’\*’) as placeholders.

<a href="#(resource)%20page_rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20targets%20%3E%20(attribute)%20constraint%20%3E%20(attribute)%20value">Link to this property</a>

</details>

<a href="#(resource)%20page_rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20targets%20%3E%20(attribute)%20constraint">Link to this property</a>

target?: String

A target based on the URL of the request.

<a href="#(resource)%20page_rules%20%3E%20(terraform%20resource)%20%3E%20(attribute)%20targets%20%3E%20(attribute)%20target">Link to this property</a>

</details>

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

##### optional Expand Collapse

priority?: Int64

The priority of the rule, used to define which Page Rule is processed over another. A higher number indicates a higher priority. For example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to take precedence (rule B: `/images/special/*`), specify a higher priority for rule B so it overrides rule A.

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

status?: String

The status of the Page Rule.

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

##### computed Expand Collapse

id: String

Identifier.

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

created\_on: Time

The timestamp of when the Page Rule was created.

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

modified\_on: Time

The timestamp of when the Page Rule was last modified.

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

### cloudflare\_page\_rule

Terraform

HTTPTypeScriptPythonGoTerraform

```
resource "cloudflare_page_rule" "example_page_rule" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  priority = 0
  status = "active"
}
```

#### data cloudflare\_page\_rule

##### required Expand Collapse

pagerule\_id: String

Identifier.

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

zone\_id: String

Identifier.

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

##### computed Expand Collapse

id: String

Identifier.

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

created\_on: Time

The timestamp of when the Page Rule was created.

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

modified\_on: Time

The timestamp of when the Page Rule was last modified.

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

priority: Int64

The priority of the rule, used to define which Page Rule is processed over another. A higher number indicates a higher priority. For example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to take precedence (rule B: `/images/special/*`), specify a higher priority for rule B so it overrides rule A.

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

status: String

The status of the Page Rule.

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

<details>

<summary>

actions: List\[Attributes]

The set of actions to perform if the targets of this rule match the request. Actions can redirect to another URL or override settings, but not both.

</summary>

id: String

If enabled, any <code>http://`` URL is converted to</code> https://\` through a 301 redirect.

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

value: String

The status of Automatic HTTPS Rewrites.

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

</details>

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

<details>

<summary>

targets: List\[Attributes]

The rule targets to evaluate on each request.

</summary>

<details>

<summary>

constraint: Attributes

String constraint.

</summary>

operator: String

The matches operator can use asterisks and pipes as wildcard and ‘or’ operators.

<a href="#(resource)%20page_rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20targets%20%3E%20(attribute)%20constraint%20%3E%20(attribute)%20operator">Link to this property</a>

value: String

The URL pattern to match against the current request. The pattern may contain up to four asterisks (’\*’) as placeholders.

<a href="#(resource)%20page_rules%20%3E%20(terraform%20datasource-single)%20%3E%20(attribute)%20targets%20%3E%20(attribute)%20constraint%20%3E%20(attribute)%20value">Link to this property</a>

</details>

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

target: String

A target based on the URL of the request.

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

</details>

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

### cloudflare\_page\_rule

Terraform

HTTPTypeScriptPythonGoTerraform

```
data "cloudflare_page_rule" "example_page_rule" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  pagerule_id = "023e105f4ecef8ad9ca31a8372d0c353"
}
```