You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/cloudflare-one/policies/gateway/application-app-types.mdx
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,3 +76,37 @@ To turn on the Microsoft 365 integration:
76
76
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.
77
77
78
78
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}]...)
Copy file name to clipboardExpand all lines: src/content/docs/cloudflare-one/policies/gateway/domain-categories.mdx
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,3 +229,44 @@ Then, the initial categorization is refined via:
229
229
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.
230
230
231
231
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
Copy file name to clipboardExpand all lines: src/content/partials/cloudflare-one/gateway/order-of-enforcement.mdx
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -180,3 +180,51 @@ When a user goes to `https://test.example.com`, Gateway performs the following o
180
180
3. Policy #3 is not evaluated because there has already been an explicit match.
181
181
182
182
Therefore, the user is able to connect to `https://test.example.com`.
183
+
184
+
### How gateway calculates precedence?
185
+
186
+
The gateway API starts assigning precedence to policies created in an account, starting with 1000, unless explictly soecified in the policy otherwise.
187
+
Every time a new policy is added to the bottom of the order, we simply calculate the highest precedence in the account at the moment and
188
+
add 1000 + rand(1...100) to the new policy, so that it now claims the maximum precedence in the account.
189
+
190
+
Gateway also provides a PUT endpoint to update the precedence of a policy, where the user can set any value for precedence that is not already claimed by another policy. This helps to position a policy in between two already existing policies.
191
+
When polcies are re arranged using dahsboard drag and drop UI, we calculate an appropriate precedence number and assigns it to the policy.
192
+
Changing the order both at UI/API and at terraform might result in stale precedence issues.
193
+
194
+
### Precedenc management via terraform
195
+
196
+
Now let's see how we can manage a large number of gateway policies and order of execution via terraform
197
+
198
+
With terraform v5, gateway users can list thier policies in a terraform file with any integer precedence value as they wish. We suggest starting with 1000 and leave enoughg of a gap inbetween the adjacent policy precedences, so we could sandwitch policies in between those precedence gap in the future.
As shown above, way we can arrange the polcies in ascending order of precedence. To move policy 3, to in between policy 1 and policy 2, simply update the precedence of policy 3 to anumber in between [1001..1999], and also move the terraform definition to in between policy 1 and policy 2.
227
+
Mandating a sufficient gap between precedences will make re ordering of policies smoother in the future.
228
+
The only thing to be careful about here is, we recomment moving one policy at a time and applying the state changes. This will cause a complicated reordering manuever to be performed as series of single moves and plan-apply cycles.
229
+
230
+
Note: If the customer uses a mix of terraform and UI/API, please sync your polices with plan refresh before you start reordering policies in the terraform. You may also lock down your account as terraform only, from the zero trust dashboard settings.
Copy file name to clipboardExpand all lines: src/content/partials/cloudflare-one/gateway/terraform-precedence-warning.mdx
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@
2
2
{}
3
3
---
4
4
5
-
:::caution[Terraform precedence limitation]
6
-
To avoid conflicts, Terraform applies a hash calculation to policy precedence. For example, a precedence of `1000` may become `1000901`. This can cause errors when reordering policies. To avoid this issue, manually set the precedence of policies created with Terraform using the [Update a Zero Trust Gateway rule](/api/resources/zero_trust/subresources/gateway/subresources/rules/methods/update/) endpoint.
5
+
:::caution[Terraform precedence limitation in v4]
6
+
To avoid conflicts, Terraform applies a hash calculation to policy precedence in v4. For example, a precedence of `1000` may become `1000901`. This can cause errors when reordering policies. To avoid this issue, manually set the precedence of policies created with Terraform using the [Update a Zero Trust Gateway rule](/api/resources/zero_trust/subresources/gateway/subresources/rules/methods/update/) endpoint.
7
+
We suggest you to move to terrafoprm v5, for hazle free handling of precedence. In v5, terraform maintains the exact precedence marked at the policy terraform file.
0 commit comments