Skip to content

Commit 0d09680

Browse files
committed
Added notes above each additional terraform example
1 parent e168b91 commit 0d09680

File tree

6 files changed

+36
-0
lines changed

6 files changed

+36
-0
lines changed

src/content/docs/terraform/additional-configurations/ddos-managed-rulesets.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ This example configures the [Network-layer DDoS Attack Protection](/ddos-protect
7979

8080
:::
8181

82+
<Render file="v4-code-snippets" />
83+
8284
```tf
8385
resource "cloudflare_ruleset" "account_level_network_ddos_config" {
8486
account_id = "<ACCOUNT_ID>"
@@ -128,6 +130,8 @@ The order of the rules is important: the rule with the highest sensitivity level
128130

129131
:::
130132

133+
<Render file="v4-code-snippets" />
134+
131135
```tf
132136
variable "zone_id" {
133137
default = "<ZONE_ID>"

src/content/docs/terraform/additional-configurations/rate-limiting-rules.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ resource "cloudflare_ruleset" "zone_rl" {
7373

7474
This example defines a [custom ruleset](/ruleset-engine/custom-rulesets/) with a single rate limiting rule in account with ID `<ACCOUNT_ID>` that blocks traffic for the `/api/` path exceeding the configured rate. The second `cloudflare_ruleset` resource defines an `execute` rule that deploys the custom ruleset for traffic addressed at `example.com`.
7575

76+
<Render file="v4-code-snippets" />
77+
7678
```tf
7779
resource "cloudflare_ruleset" "account_rl" {
7880
account_id = <ACCOUNT_ID>
@@ -127,6 +129,8 @@ This example creates a rate limiting rule in zone with ID `<ZONE_ID>` with:
127129
- A custom counting expression that includes a response field (`http.response.code`).
128130
- A custom JSON response for rate limited requests.
129131

132+
<Render file="v4-code-snippets" />
133+
130134
```tf
131135
resource "cloudflare_ruleset" "zone_rl_custom_response" {
132136
zone_id = "<ZONE_ID>"

src/content/docs/terraform/additional-configurations/transform-rules.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ The following configuration example performs the following adjustments to HTTP r
7171
- Adds a `my-header-2` header to the request with a dynamic value defined by an expression.
7272
- Deletes the `existing-header` header from the request, if it exists.
7373

74+
<Render file="v4-code-snippets" />
75+
7476
```tf
7577
resource "cloudflare_ruleset" "transform_modify_request_headers" {
7678
zone_id = "<ZONE_ID>"
@@ -119,6 +121,8 @@ The following configuration example performs the following adjustments to HTTP r
119121
- Adds a `my-header-2` header to the response with a dynamic value defined by an expression.
120122
- Deletes the `existing-header` header from the response, if it exists.
121123

124+
<Render file="v4-code-snippets" />
125+
122126
```tf
123127
resource "cloudflare_ruleset" "transform_modify_response_headers" {
124128
zone_id = "<ZONE_ID>"

src/content/docs/terraform/additional-configurations/waf-custom-rules.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ For more information on enabling leaked credentials detection using Terraform, r
6969

7070
This example adds a custom rule that challenges requests with leaked credentials by using one of the [leaked credentials fields](/waf/detections/leaked-credentials/#leaked-credentials-fields) in the rule expression.
7171

72+
<Render file="v4-code-snippets" />
73+
7274
```tf
7375
resource "cloudflare_ruleset" "zone_custom_firewall_leaked_creds" {
7476
zone_id = "<ZONE_ID>"
@@ -96,6 +98,8 @@ For more information on enabling malicious uploads detection using Terraform, re
9698

9799
This example adds a custom rule that blocks requests with one or more <GlossaryTooltip term="content object">content objects</GlossaryTooltip> considered malicious by using one of the [content scanning fields](/waf/detections/malicious-uploads/#content-scanning-fields) in the rule expression.
98100

101+
<Render file="v4-code-snippets" />
102+
99103
```tf
100104
resource "cloudflare_ruleset" "zone_custom_firewall_malicious_uploads" {
101105
zone_id = "<ZONE_ID>"
@@ -127,6 +131,8 @@ You can only create and deploy custom rulesets at the account level.
127131

128132
The following configuration creates the custom ruleset with a single rule:
129133

134+
<Render file="v4-code-snippets" />
135+
130136
```tf
131137
resource "cloudflare_ruleset" "account_firewall_custom_ruleset" {
132138
account_id = "<ACCOUNT_ID>"
@@ -151,6 +157,8 @@ resource "cloudflare_ruleset" "account_firewall_custom_ruleset" {
151157

152158
The following configuration deploys the custom ruleset at the account level. It defines a dependency on the `account_firewall_custom_ruleset` resource and uses the ID of the created custom ruleset in `action_parameters`:
153159

160+
<Render file="v4-code-snippets" />
161+
154162
```tf
155163
resource "cloudflare_ruleset" "account_firewall_custom_entrypoint" {
156164
account_id = "<ACCOUNT_ID>"
@@ -183,6 +191,8 @@ The following configuration creates a custom ruleset with a single rule that [ch
183191

184192
You can only add exposed credential checks to rules in a custom ruleset (that is, a ruleset with `kind = "custom"`).
185193

194+
<Render file="v4-code-snippets" />
195+
186196
```tf
187197
resource "cloudflare_ruleset" "account_firewall_custom_ruleset_exposed_creds" {
188198
account_id = "<ACCOUNT_ID>"
@@ -215,6 +225,8 @@ resource "cloudflare_ruleset" "account_firewall_custom_ruleset_exposed_creds" {
215225

216226
The following configuration deploys the custom ruleset. It defines a dependency on the `account_firewall_custom_ruleset_exposed_creds` resource and obtains the ID of the created custom ruleset:
217227

228+
<Render file="v4-code-snippets" />
229+
218230
```tf
219231
resource "cloudflare_ruleset" "account_firewall_custom_entrypoint" {
220232
account_id = "<ACCOUNT_ID>"

src/content/docs/terraform/additional-configurations/waf-managed-rulesets.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ resource "cloudflare_ruleset" "zone_level_managed_waf" {
8282

8383
The following example deploys two managed rulesets to the account with ID `<ACCOUNT_ID>` using Terraform, using a `cloudflare_ruleset` resource with two rules that execute the managed rulesets for two hostnames belonging to Enterprise zones.
8484

85+
<Render file="v4-code-snippets" />
86+
8587
```tf
8688
resource "cloudflare_ruleset" "account_level_managed_waf" {
8789
account_id = "<ACCOUNT_ID>"
@@ -125,6 +127,8 @@ The following example adds two [skip rules](/waf/managed-rules/waf-exceptions/)
125127

126128
Add the two skip rules to the `cloudflare_ruleset` resource before the rule that deploys the Cloudflare Managed Ruleset:
127129

130+
<Render file="v4-code-snippets" />
131+
128132
```tf null {4-13,15-27}
129133
resource "cloudflare_ruleset" "zone_level_managed_waf" {
130134
# (...)
@@ -186,6 +190,8 @@ The following example adds three [overrides](/ruleset-engine/managed-rulesets/ov
186190

187191
The following configuration includes the three overrides in the rule that executes the Cloudflare Managed Ruleset:
188192

193+
<Render file="v4-code-snippets" />
194+
189195
```tf null {9-24}
190196
# (...)
191197
@@ -225,6 +231,8 @@ This example enables [payload logging](/waf/managed-rules/payload-logging/) for
225231

226232
Building upon the rule that deploys the Cloudflare Managed Ruleset, the following rule configuration adds the `matched_data` object with the public key used to encrypt the payload:
227233

234+
<Render file="v4-code-snippets" />
235+
228236
```tf null {9-11}
229237
# (...)
230238
@@ -264,6 +272,8 @@ The following example rule of a `cloudflare_ruleset` Terraform resource performs
264272
- Sets the score threshold to `60` (_Low_).
265273
- Sets the ruleset action to `log`.
266274

275+
<Render file="v4-code-snippets" />
276+
267277
```tf null {8-25}
268278
# (...)
269279

src/content/docs/terraform/advanced-topics/import-cloudflare-resources.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ cf-terraforming generate --email $CLOUDFLARE_EMAIL --token $CLOUDFLARE_API_TOKEN
7373

7474
If you had not redirected the output to the `importing-example.tf` file, the result displayed in the standard output (your terminal window) would look like the following:
7575

76+
<Render file="v4-code-snippets" />
77+
7678
```tf
7779
resource "cloudflare_record" "terraform_managed_resource_3c0b456bc2aa443089c5f40f45f51b31" {
7880
name = "@"

0 commit comments

Comments
 (0)