Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow `zone_id` to set `zone` and vice versa During an import of the `clouflare_filter` resource, the `zone_id` is defined within the composite ID. This value is then populated and synced within `resourceCloudflareFilterRead` to match the expected schema resource. However, we don't currently set `zone` (the zone name) anywhere. This becomes problematic on subsequent terraform operations as the `Read` attempts to sync the schema with the filter and ends up attempting to recreate the resource due to detecting a change. Initially I thought we could just iterate over all zones and pull out the one that matched the zone ID but this only works _if_ the zone ID has been provided (which isn't guaranteed since both fields are optional but one is required). Instead, I've opted to ensure we update both the `zone` and `zone_id` properties when we have one of them. I.e when we only have the `zone_id`, use that value to find and set the `zone` value (and vice versa). This will ensure that both values are defined and a change in either will retrigger the update. Fixes #161.
- Loading branch information