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/terraform/troubleshooting/rule-id-changes.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
---
2
2
pcx_content_type: troubleshooting
3
-
title: The rule ID changes when I modify a rule
3
+
title: Rule IDs change when I modify a ruleset
4
4
sidebar:
5
-
label: Rule ID changes
5
+
label: Rule IDs change when making updates
6
6
---
7
7
8
-
For [`cloudflare_ruleset`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/ruleset) resources, the Cloudflare provider may delete a rule and create a new one when you modify a ruleset rule in your Terraform configuration. This happens because the API cannot match rules in your new Terraform configuration with existing rules in your Cloudflare configuration. Modifying a rule in your Terraform configuration and applying the changes will create a new rule with a different rule ID in your Cloudflare account or zone.
8
+
For [`cloudflare_ruleset`](https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/ruleset) resources, the Cloudflare provider may delete a rule and create a new one when you modify a ruleset in your Terraform configuration. This happens because the API cannot match rules in your new Terraform configuration with existing rules in your Cloudflare configuration. Modifying a ruleset in your Terraform configuration and applying the changes will create new rules with different rule IDs in your Cloudflare account or zone.
9
9
10
10
This behavior may have an impact on any automation or monitoring systems you may have configured that rely on having immutable rule IDs between rule modifications.
11
11
12
12
## How to keep the same rule ID between modifications
13
13
14
-
To keep the existing rule ID when making changes to a rule through Terraform, add a `ref` field to the rule.
14
+
To keep existing rule IDs when making changes to a ruleset through Terraform, add a `ref` field to each rule.
15
15
16
16
The `ref` field is a user-defined external identifier that must be unique for each rule in a ruleset. When you provide a `ref` value, the provider will match the rule in your updated Terraform configuration with the existing rule with the same `ref` external identifier, and the rule ID will be preserved.
17
17
@@ -25,4 +25,4 @@ By default, when you create a rule, its `ref` value will be equal to the rule ID
25
25
26
26
When you [import your existing Cloudflare configuration to Terraform](/terraform/advanced-topics/import-cloudflare-resources/) using [`cf-terraforming`](https://github.com/cloudflare/cf-terraforming), the generated Terraform configuration will have `ref` values for each rule, with the same value as the rule ID.
27
27
28
-
If you manually created your Terraform configuration and your rules' configuration does not have a `ref` field, add a `ref` field to each rule so that each rule modification does not generate a new rule ID.
28
+
If you manually created your Terraform configuration and your rules' configuration does not have a `ref` field, add a `ref` field to each rule so that each ruleset modification does not generate new rule IDs.
0 commit comments