Skip to content

Commit 09414ca

Browse files
committed
Added terraform code
1 parent 3c7697a commit 09414ca

File tree

1 file changed

+20
-1
lines changed
  • src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies

1 file changed

+20
-1
lines changed

src/content/docs/learning-paths/secure-internet-traffic/build-dns-policies/create-policy.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ To create a new DNS policy using **cURL**:
3838
--data '{
3939
"name": "All-DNS-SecurityCategories-Blocklist",
4040
"description": "Block known security risks based on Cloudflare's threat intelligence",
41-
"precedence": 1,
41+
"precedence": 0,
4242
"enabled": false,
4343
"action": "block",
4444
"filters": [
@@ -52,4 +52,23 @@ To create a new DNS policy using **cURL**:
5252
}'
5353
```
5454
</TabItem>
55+
<TabItem label="Terraform">
56+
To create a new DNS policy using **Terraform**:
57+
```tf
58+
resource "cloudflare_zero_trust_gateway_policy" "security_risks_dns_policy" {
59+
account_id = var.account_id
60+
name = "All-DNS-SecurityCategories-Blocklist"
61+
description = "Block known security risks based on Cloudflare's threat intelligence"
62+
precedence = 0
63+
enabled = false
64+
action = "block"
65+
filters = ["dns"]
66+
traffic = "any(dns.security_category[*] in {68 178 80 83 176 175 117 131 134 151 153})"
67+
rule_settings {
68+
block_page_enabled = true
69+
block_page_reason = "This domain was blocked due to being classified as a security risk to the organisation"
70+
}
71+
}
72+
```
73+
</TabItem>
5574
</Tabs>

0 commit comments

Comments
 (0)