From af8fe8ae2d8d6a48c0099403b7e7d0c60c6b5443 Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Fri, 19 Jul 2019 06:22:13 +1000 Subject: [PATCH] Deprecation for `zone` in favour of explicit `zone_id` Zone names within Cloudflare are not universally unique which makes performing a lookup based on just the name a little troublesome. Two accounts can have the same zone name and both of these can be returned if the lookups are not restricted to the zone ID or account ID. To rememdy this, `zone` is being deprecated in favour of explicit `zone_id` values. See the discussion[1] on this for full details. Following Terraform's guidelines for deprecations[2], we are putting in a deprecation notice as part of a minor release and then in our next major release, we will actually perform the schema and functionality removal. This update will not prevent people from using `zone` however use will trigger a warning that it's going away and they should migrate themselves. [1]: https://github.com/terraform-providers/terraform-provider-cloudflare/issues/161#issuecomment-441128985 [2]: https://www.terraform.io/docs/extend/best-practices/deprecations.html#provider-attribute-removal --- cloudflare/resource_cloudflare_access_rule.go | 1 + cloudflare/resource_cloudflare_filter.go | 1 + cloudflare/resource_cloudflare_firewall_rule.go | 1 + cloudflare/resource_cloudflare_load_balancer.go | 1 + cloudflare/resource_cloudflare_page_rule.go | 1 + cloudflare/resource_cloudflare_rate_limit.go | 1 + cloudflare/resource_cloudflare_waf_rule.go | 1 + cloudflare/resource_cloudflare_worker_route.go | 1 + cloudflare/resource_cloudflare_worker_script.go | 1 + cloudflare/resource_cloudflare_zone_lockdown.go | 1 + 10 files changed, 10 insertions(+) diff --git a/cloudflare/resource_cloudflare_access_rule.go b/cloudflare/resource_cloudflare_access_rule.go index eddfcfd7c0a..578f3b0000e 100644 --- a/cloudflare/resource_cloudflare_access_rule.go +++ b/cloudflare/resource_cloudflare_access_rule.go @@ -26,6 +26,7 @@ func resourceCloudflareAccessRule() *schema.Resource { Optional: true, ForceNew: true, Computed: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { Type: schema.TypeString, diff --git a/cloudflare/resource_cloudflare_filter.go b/cloudflare/resource_cloudflare_filter.go index ee33af74e16..dacbeadc4b9 100644 --- a/cloudflare/resource_cloudflare_filter.go +++ b/cloudflare/resource_cloudflare_filter.go @@ -26,6 +26,7 @@ func resourceCloudflareFilter() *schema.Resource { Optional: true, ForceNew: true, Computed: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { Type: schema.TypeString, diff --git a/cloudflare/resource_cloudflare_firewall_rule.go b/cloudflare/resource_cloudflare_firewall_rule.go index 1ce918aa164..79856b9d9b2 100644 --- a/cloudflare/resource_cloudflare_firewall_rule.go +++ b/cloudflare/resource_cloudflare_firewall_rule.go @@ -26,6 +26,7 @@ func resourceCloudflareFirewallRule() *schema.Resource { Optional: true, ForceNew: true, Computed: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { Type: schema.TypeString, diff --git a/cloudflare/resource_cloudflare_load_balancer.go b/cloudflare/resource_cloudflare_load_balancer.go index b172502a34e..0c148fb6559 100644 --- a/cloudflare/resource_cloudflare_load_balancer.go +++ b/cloudflare/resource_cloudflare_load_balancer.go @@ -29,6 +29,7 @@ func resourceCloudflareLoadBalancer() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { diff --git a/cloudflare/resource_cloudflare_page_rule.go b/cloudflare/resource_cloudflare_page_rule.go index 4e914099094..52e943ae83b 100644 --- a/cloudflare/resource_cloudflare_page_rule.go +++ b/cloudflare/resource_cloudflare_page_rule.go @@ -27,6 +27,7 @@ func resourceCloudflarePageRule() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { diff --git a/cloudflare/resource_cloudflare_rate_limit.go b/cloudflare/resource_cloudflare_rate_limit.go index 9d54fcc087f..da8676ebc48 100644 --- a/cloudflare/resource_cloudflare_rate_limit.go +++ b/cloudflare/resource_cloudflare_rate_limit.go @@ -27,6 +27,7 @@ func resourceCloudflareRateLimit() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { diff --git a/cloudflare/resource_cloudflare_waf_rule.go b/cloudflare/resource_cloudflare_waf_rule.go index cb4494647bf..ad57ded7fe0 100644 --- a/cloudflare/resource_cloudflare_waf_rule.go +++ b/cloudflare/resource_cloudflare_waf_rule.go @@ -29,6 +29,7 @@ func resourceCloudflareWAFRule() *schema.Resource { "zone": { Type: schema.TypeString, Required: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { diff --git a/cloudflare/resource_cloudflare_worker_route.go b/cloudflare/resource_cloudflare_worker_route.go index 08b3cd92a1d..850eee13db4 100644 --- a/cloudflare/resource_cloudflare_worker_route.go +++ b/cloudflare/resource_cloudflare_worker_route.go @@ -25,6 +25,7 @@ func resourceCloudflareWorkerRoute() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { diff --git a/cloudflare/resource_cloudflare_worker_script.go b/cloudflare/resource_cloudflare_worker_script.go index cb3a88b1b55..8d3fa9ef19f 100644 --- a/cloudflare/resource_cloudflare_worker_script.go +++ b/cloudflare/resource_cloudflare_worker_script.go @@ -27,6 +27,7 @@ func resourceCloudflareWorkerScript() *schema.Resource { ForceNew: true, // zone is used for single-script, name is used for multi-script ConflictsWith: []string{"name"}, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { diff --git a/cloudflare/resource_cloudflare_zone_lockdown.go b/cloudflare/resource_cloudflare_zone_lockdown.go index 746e1ad9edd..61e575d57c9 100644 --- a/cloudflare/resource_cloudflare_zone_lockdown.go +++ b/cloudflare/resource_cloudflare_zone_lockdown.go @@ -25,6 +25,7 @@ func resourceCloudflareZoneLockdown() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + Deprecated: "`zone` is deprecated in favour of explicit `zone_id` and will be removed in the next major release", }, "zone_id": { Type: schema.TypeString,