Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/flaconi/terraform-cloudflare-page-rules

This module will create Cloudflare Page Rules
https://github.com/flaconi/terraform-cloudflare-page-rules

cloudflare terraform terraform-module

Last synced: about 4 hours ago
JSON representation

This module will create Cloudflare Page Rules

Awesome Lists containing this project

README

        

# Terraform module: Cloudflare Page Rules

[![lint](https://github.com/flaconi/terraform-cloudflare-pagerules/workflows/lint/badge.svg)](https://github.com/flaconi/terraform-cloudflare-pagerules/actions?query=workflow%3Alint)
[![test](https://github.com/flaconi/terraform-cloudflare-pagerules/workflows/test/badge.svg)](https://github.com/flaconi/terraform-cloudflare-pagerules/actions?query=workflow%3Atest)
[![Tag](https://img.shields.io/github/tag/flaconi/terraform-cloudflare-pagerules.svg)](https://github.com/flaconi/terraform-cloudflare-pagerules/releases)
[![Terraform](https://img.shields.io/badge/Terraform--registry-cloudflare--page--rules-brightgreen.svg)](https://registry.terraform.io/modules/flaconi/page-rules/cloudflare/)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

## Priority of rules

This module omits the `priority` key for rulesets and auto-calculates those by the order they appear in the `page_rules` list.

## Example

`terraform.tfvars`:
```hcl
domain = ""

page_rules = [
{
target = ""
status = "disabled"
actions = {
forwarding_url = [{
status_code = ""
url = ""
}]
}
},
{
target = ""
actions = {
always_use_https = "true"
}
}
]
```

## Providers

| Name | Version |
|------|---------|
| [cloudflare](#provider\_cloudflare) | ~> 4.20 |

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.5 |
| [cloudflare](#requirement\_cloudflare) | ~> 4.20 |

## Required Inputs

The following input variables are required:

### [api\_token](#input\_api\_token)

Description: The Cloudflare API token.

Type: `string`

### [domain](#input\_domain)

Description: Cloudflare domain to apply rules for.

Type: `string`

## Optional Inputs

The following input variables are optional (have default values):

### [page\_rules](#input\_page\_rules)

Description: List of Cloudflare page rule objects.

Type:

```hcl
list(object({
target = string
status = optional(string, "active")
actions = object({
always_use_https = optional(bool, false)
disable_apps = optional(bool, false)
disable_performance = optional(bool, false)
disable_railgun = optional(bool, false)
disable_security = optional(bool, false)
disable_zaraz = optional(bool, false)
edge_cache_ttl = optional(number)
automatic_https_rewrites = optional(string)
browser_cache_ttl = optional(number)
browser_check = optional(string)
bypass_cache_on_cookie = optional(string)
cache_on_cookie = optional(string)
cache_by_device_type = optional(string)
cache_deception_armor = optional(string)

cache_key_fields = optional(list(object({
query_string = object({
exclude = optional(list(string), [])
include = optional(list(string), [])
ignore = optional(bool, false)
})
header = object({
exclude = optional(list(string), [])
include = optional(list(string), [])
check_presence = optional(list(string), [])
})
cookie = object({
include = optional(list(string), [])
check_presence = optional(list(string), [])
})
host = object({
resolved = optional(bool, false)
})
user = object({
lang = optional(bool, false)
device_type = optional(bool, false)
geo = optional(bool, false)
})
})), [])

cache_level = optional(string)

cache_ttl_by_status = optional(list(object({
codes = string
ttl = number
})), [])

email_obfuscation = optional(string)
explicit_cache_control = optional(string)

forwarding_url = optional(list(object({
status_code = string
url = string
})), [])

host_header_override = optional(string)
ip_geolocation = optional(string)

minify = optional(list(object({
html = string
css = string
js = string
})), [])

mirage = optional(string)
opportunistic_encryption = optional(string)
origin_error_page_pass_thru = optional(string)
polish = optional(string)
resolve_override = optional(string)
respect_strong_etag = optional(string)
response_buffering = optional(string)
rocket_loader = optional(string)
security_level = optional(string)
server_side_exclude = optional(string)
sort_query_string_for_cache = optional(string)
ssl = optional(string)
true_client_ip_header = optional(string)
waf = optional(string)
})
}))
```

Default: `[]`

## Outputs

| Name | Description |
|------|-------------|
| [domain](#output\_domain) | Current zone information. |
| [page\_rules](#output\_page\_rules) | Created Cloudflare page rules for the current zone. |

## License

**[MIT License](LICENSE)**

Copyright (c) 2022 **[Flaconi GmbH](https://github.com/flaconi)**