Skip to content

Commit

Permalink
Deprecation for zone in favour of explicit zone_id
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jacobbednarz committed Jul 18, 2019
1 parent 6b900f2 commit c75c477
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 29 deletions.
9 changes: 5 additions & 4 deletions cloudflare/resource_cloudflare_access_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ func resourceCloudflareAccessRule() *schema.Resource {

Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Type: schema.TypeString,
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,
Expand Down
9 changes: 5 additions & 4 deletions cloudflare/resource_cloudflare_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ func resourceCloudflareFilter() *schema.Resource {

Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Type: schema.TypeString,
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,
Expand Down
9 changes: 5 additions & 4 deletions cloudflare/resource_cloudflare_firewall_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ func resourceCloudflareFirewallRule() *schema.Resource {

Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Type: schema.TypeString,
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,
Expand Down
7 changes: 4 additions & 3 deletions cloudflare/resource_cloudflare_load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ func resourceCloudflareLoadBalancer() *schema.Resource {
SchemaVersion: 0,
Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
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": {
Expand Down
7 changes: 4 additions & 3 deletions cloudflare/resource_cloudflare_page_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ func resourceCloudflarePageRule() *schema.Resource {
SchemaVersion: 0,
Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
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": {
Expand Down
7 changes: 4 additions & 3 deletions cloudflare/resource_cloudflare_rate_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ func resourceCloudflareRateLimit() *schema.Resource {
SchemaVersion: 0,
Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
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": {
Expand Down
5 changes: 3 additions & 2 deletions cloudflare/resource_cloudflare_waf_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ func resourceCloudflareWAFRule() *schema.Resource {
},

"zone": {
Type: schema.TypeString,
Required: true,
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": {
Expand Down
7 changes: 4 additions & 3 deletions cloudflare/resource_cloudflare_worker_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ func resourceCloudflareWorkerRoute() *schema.Resource {

Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
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": {
Expand Down
1 change: 1 addition & 0 deletions cloudflare/resource_cloudflare_worker_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 4 additions & 3 deletions cloudflare/resource_cloudflare_zone_lockdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ func resourceCloudflareZoneLockdown() *schema.Resource {

Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
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,
Expand Down

0 comments on commit c75c477

Please sign in to comment.