A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.cloudflare.com/rules/snippets/create-terraform/ below:

Configure Snippets using Terraform · Cloudflare Rules docs

You can create Snippets using the Terraform Cloudflare provider ↗.

To get started with Terraform for Cloudflare configuration, refer to Terraform: Get started.

Note

Terraform code snippets below refer to the v4 SDK only.

The following example Terraform configuration creates a snippet and an associated snippet rule that defines when the snippet code will run. The snippet code is loaded from the file1.js file in your machine.

resource "cloudflare_snippet" "my_snippet" {

zone_id = "<ZONE_ID>"

name = "my_test_snippet_1"

main_module = "file1.js"

files {

name = "file1.js"

content = file("file1.js")

}

}

resource "cloudflare_snippet_rules" "cookie_snippet_rule" {

zone_id = "<ZONE_ID>"

rules {

enabled = true

expression = "http.cookie eq \"a=b\""

description = "Trigger snippet on specific cookie"

snippet_name = "my_test_snippet_1"

}

depends_on = [cloudflare_snippet.my_snippet]

}

The name of a snippet can only contain the characters a-z, 0-9, and _ (underscore). The name must be unique in the context of the zone. You cannot change the snippet name after creating the snippet.

All snippet_name values in the cloudflare_snippet_rules resource must match the names of existing snippets.

Refer to the Terraform Cloudflare provider documentation ↗ for more information on the cloudflare_snippet and cloudflare_snippet_rules resources.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4