-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Managing Cloudflare Ruleset Order via Terraform #4711
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Thank you for reporting this issue! For maintainers to dig into issues it is required that all issues include the entirety of This issue has been marked with |
i can't speak to your example here (i don't quite understand how/why you're doing what you're doing) however, inserting or removing one of the rules is expected to show a diff of replacing all the remaining rules as they are explicitly ordered. so while you may have rule 1, 2, and 3, if you remove rule 1, you are actually moving rule 2 -> 1 and rule 3 -> 2 which terraform needs to reflect in the state and API calls. |
Confirmation
Terraform and Cloudflare provider version
terraform version : 1.3.9
cloudflare provider version : 4.46.0
Affected resource(s)
cloudflare_ruleset
Terraform configuration files
Link to debug output
NA
Panic output
No response
Expected output
When i try to delete 2nd rule from the input file i expect the plan generated to just remove that rule and doensot impact rest of the rules.
Actual output
But the plan generated is modifying all the rules after second rule and then deleting the second rule as these rules are order oriented.
Steps to reproduce
Additional factoids
We are currently managing and creating Cloudflare rulesets and rules across multiple zones using Terraform. As you know, the rules in Cloudflare are order-sensitive. Whenever we generate a Terraform plan that includes changes—such as the deletion or addition of a new rule—it results in changes to the order of all existing rules. This is reflected in the Terraform plan, causing updates to all the rules, even when their actual content remains unchanged. We would like to inquire if there is a way to manage or specify the order of rules directly within the Terraform configuration. Specifically:
Is there an attribute or approach in Terraform that allows us to define a rule's order explicitly, ensuring only the intended changes are applied without affecting unrelated rules?
If no such feature currently exists, is there a recommended best practice for managing ordered rulesets in Terraform while minimizing the impact on existing rules?
Are there alternative solutions or APIs that can help us achieve this level of control?
We are seeking a method to avoid unnecessary modifications to unrelated rules when making changes, as this can have implications for both deployment workflows and rule stability.
References
No response
The text was updated successfully, but these errors were encountered: