Skip to content

Commit 34c3e93

Browse files
author
Rex Scaria
committed
add doc on handling categories and app types in gateway via terraform
1 parent b5d99ea commit 34c3e93

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

src/content/docs/cloudflare-one/policies/gateway/application-app-types.mdx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,37 @@ To turn on the Microsoft 365 integration:
7676
3. To verify the policy was created, select **View policy**. Alternatively, go to **Gateway** > **Firewall policies** > **HTTP**. A policy named Microsoft 365 Auto Generated will be enabled in your list.
7777

7878
All future Microsoft 365 traffic will bypass Gateway logging and filtering. To disable this behavior, turn off or delete the policy.
79+
80+
### How to use app types in terraform?
81+
82+
For terraform users, we offer app types list as a dataset, so that you don't have to mention them by integer id, and instead you can mention them in your policy by the app name.
83+
84+
Example terraform app types setup
85+
86+
<pre>
87+
```
88+
data "cloudflare_zero_trust_gateway_app_types_list" "gateway_apptypes" {
89+
account_id = "<accounbt-id-string>"
90+
}
91+
92+
93+
locals {
94+
apptypes_map = merge([
95+
for c in data.cloudflare_zero_trust_gateway_app_types_list.gateway_apptypes.result : {(c.name) = c.id}]...)
96+
}
97+
98+
resource "cloudflare_zero_trust_gateway_policy" "zt_block_dns_apps" {
99+
account_id = "<accounbt-id-string>"
100+
name = "DNS Blocked apps"
101+
action = "block"
102+
traffic = "any(app.ids[*] in {${join(" ", [
103+
local.apptypes_map["Discord"],
104+
local.apptypes_map["GoToMeeting"],
105+
local.apptypes_map["Greenhouse"],
106+
local.apptypes_map["Zelle"],
107+
local.apptypes_map["Microsoft Visual Studio"]
108+
])}})"
109+
}
110+
111+
```
112+
</pre>

src/content/docs/cloudflare-one/policies/gateway/domain-categories.mdx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,44 @@ Then, the initial categorization is refined via:
229229
3. Machine learning models. Our algorithms, including DGA Domains, DNS tunneling, and phishing detection models analyze patterns and behaviors to detect new and evolving threats.
230230

231231
4. Community feedback. Through a review process, Cloudflare assesses feedback by both our internal models and threat analysts. This ensures that our categorizations reflect the most current and accurate threat intelligence.
232+
233+
## How to use categories in terraform?
234+
235+
For terraform users, we offer categories as a dataset, so that you don't have to mention them by integer id, and instead you can mention them in your policy by the category name.
236+
237+
Example terraform category setup
238+
239+
<pre>
240+
```
241+
data "cloudflare_zero_trust_gateway_categories_list" "categories" {
242+
account_id = "<accounbt-id-string>"
243+
}
244+
245+
246+
locals {
247+
main_categories_map = {
248+
for idx, c in data.cloudflare_zero_trust_gateway_categories_list.categories[0].result:
249+
c.name => c.id
250+
}
251+
252+
subcategories_map = merge(flatten([
253+
for idx, c in data.cloudflare_zero_trust_gateway_categories_list.categories[0].result: {
254+
for k,v in coalesce(c.subcategories, []): v.name => v.id
255+
}])...)
256+
}
257+
258+
resource "cloudflare_zero_trust_gateway_policy" "zt_block_dns_tech_categories" {
259+
account_id = "<accounbt-id-string>"
260+
name = "DNS Blocked"
261+
action = "block"
262+
traffic = "any(dns.content_category[*] in {${join(" ", [
263+
local.main_categories_map["Technology"],
264+
local.subcategories_map["APIs"],
265+
local.subcategories_map["Artificial Intelligence"],
266+
local.subcategories_map["Content Servers"],
267+
local.subcategories_map["Translator"]
268+
])}})"
269+
}
270+
271+
```
272+
</pre>

0 commit comments

Comments
 (0)