-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resource/cloudflare_ruleset: improve dashboard collisions
One of the earliest niggles with customers coming from the dashboard to Terraform was the collision caused by a Ruleset phase being created in the UI but the Terraform provider also needing to create the same phase. This was problematic for a few reasons: - The first was that when you deleted Ruleset rules in the UI, it didn't remove the phase. This was intentional but hidden behind the UI and only accessible via the API. - Secondly, when customers wanted to use Terraform, there was an assumption they would be starting from scratch and many were not. - Finally, in the event of a collision, we didn't know which Ruleset the customer wanted to use so we error'd out with a link to manually resolve which isn't a great solution but made the issue more prominent. I had a chance to rethink through this issue and managed to find a way that we improve all three points above and remove majority of the pain points. With the proposed changes, the only time a customer needs to manually resolve the Ruleset rules is if there are existing rules in the UI which requires them to be deleted or migrated. Achieving this requires the assumption that if the Ruleset has no rules, it is ok to modify. Unfortunately, it's not that simple in practice. If the phase already exists, we cannot just update it as the `name` attribute is not writable after creation. Along with this, the `ref` and `version` values will be automatically incremented causing a permadiff in Terraform as the customer hasn't actually modified these values but the backing service (and API) has. To work around this, if we find a phase with no rules, we recreate it with the provided values which is essentially the same the same thing as the "happy path" for a new Terraform resource would be anyway.
- Loading branch information
1 parent
1c19d9f
commit 7dc1827
Showing
2 changed files
with
49 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
resource/cloudflare_ruleset: smoother handling of UI/API collisions during migrations | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters