Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cloudflare_snippet and cloudflare_snippet_rules docs #4750

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/4750.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:enhancement
resource/cloudflare_snippet: document cloudflare_snippet with example and import syntax
resource/cloudflare_snippet_rules: document cloudflare_snippet_rules with example
```
23 changes: 22 additions & 1 deletion docs/resources/snippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@ description: |-

The [Snippet](https://developers.cloudflare.com/rules/snippets/) resource allows you to create and manage snippet for a zone.


## Example Usage

```terraform
# Example for cloudflare snippet feature
resource "cloudflare_snippet" "example" {
zone_id = "0da42c8d2132a9ddaf714f9e7c920711"
name = "example-snippet"
main_module = "file1.js"
files {
name = "file1.js"
content = "export default {async fetch(request) {return fetch(request)}};"
}
}
```
<!-- schema generated by tfplugindocs -->
## Schema

Expand All @@ -34,4 +47,12 @@ Optional:

- `content` (String) Content of the snippet file.

## Import

Import is supported using the following syntax:

```shell
terraform import cloudflare_snippet.example <zone_id>/<snippet_id>
```


21 changes: 20 additions & 1 deletion docs/resources/snippet_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@ description: |-

The [Snippet Rules](https://developers.cloudflare.com/rules/snippets/) resource allows you to create and manage snippet rules for a zone.


## Example Usage

```terraform
# Example for cloudflare snippet feature
resource "cloudflare_snippet_rules" "example" {
zone_id = "0da42c8d2132a9ddaf714f9e7c920711"
rules {
enabled = true
expression = "true"
description = "some description 1"
snippet_name = "example-snippet"
}
rules {
enabled = true
expression = "true"
description = "some description 2"
snippet_name = "test_snippet_1"
}
}
```
<!-- schema generated by tfplugindocs -->
## Schema

Expand Down
Loading