-
Notifications
You must be signed in to change notification settings - Fork 630
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
resource/cloudflare_ruleset: Improve diffs when only some rules are changed #4697
Conversation
changelog detected ✅ |
3e07a47
to
a00a466
Compare
we'll want to remove the |
looks like this test has also started failing (on master) so we should update it while we're here.
otherwise, lgtm! |
tests all passing here (ignore those other failures for the moment while we fix them)
|
This logic tries to detect which rules are the same as before during an update, and preserve the refs (and therefore IDs) of these rules. However, this logic is fallible, since we cannot know the user's true intention, and makes it difficult for us to remove the `version` and `last_updated` fields from rules. If users want to preserve rule refs across updates, they can now actually use the `ref` field directly—and there is no need for this remapping logic anymore.
These fields frequently change, leading to verbose diffs in plans. Since these fields are not really useful within Terraform, we remove them from the schema completely to prevent them from "polluting" diffs. This also matches the behavior we have for the ruleset-level `version` and `last_updated` fields, which are also not represented in the Terraform schema.
In the Rulesets API, it is possible to prevent rule IDs from changing across updates by using rule refs. If a rule's ref does not change as part of an update, then neither will its ID. However, Terraform does not know this and always reports that rule IDs may change, which creates very large diffs. In this change, we use a resource plan modifier to "teach" Terraform this rule.
This action parameter is used within the execute action, but cannot actually be set to anything other than `latest`. Removing this field from Terraform prevents an issue where it shows up in diffs, due to it being a computed attribute.
Follows on from #4697 to cleanup the state automatically. Signed-off-by: Jacob Bednarz <[email protected]>
Follows on from #4697 to cleanup the state automatically. Signed-off-by: Jacob Bednarz <[email protected]>
Follows on from #4697 to cleanup the state automatically. Signed-off-by: Jacob Bednarz <[email protected]>
This functionality has been released in v4.48.0 of the Terraform Cloudflare Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Remove version in ruleset rule action parameters
This action parameter is used within the execute action, but cannot
actually be set to anything other than
latest
.Removing this field from Terraform prevents an issue where it shows up
in diffs, due to it being a computed attribute.
Prevent ruleset rule IDs incorrectly showing as changed in diffs
In the Rulesets API, it is possible to prevent rule IDs from changing
across updates by using rule refs. If a rule's ref does not change as
part of an update, then neither will its ID.
However, Terraform does not know this and always reports that rule IDs
may change, which creates very large diffs. In this change, we use a
resource plan modifier to "teach" Terraform this rule.
Remove
version
andlast_updated
fields from ruleset rulesThese fields frequently change, leading to verbose diffs in plans. Since
these fields are not really useful within Terraform, we remove them from
the schema completely to prevent them from "polluting" diffs.
This also matches the behavior we have for the ruleset-level
version
and
last_updated
fields, which are also not represented in theTerraform schema.
Remove logic to preserve ruleset rule refs
This logic tries to detect which rules are the same as before during an
update, and preserve the refs (and therefore IDs) of these rules.
However, this logic is fallible, since we cannot know the user's true
intention, and makes it difficult for us to remove the
version
andlast_updated
fields from rules.If users want to preserve rule refs across updates, they can now
actually use the
ref
field directly—and there is no need for thisremapping logic anymore.
Closes #2690