From f8662962029464dfcce248575377eb817bf66fa6 Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Wed, 31 May 2023 20:01:19 +1000 Subject: [PATCH] resource/cloudflare_list: remove `IsIPAddress` validation This was added in 4.7.0 after seeing some incorrect API payloads but the internals of the validation do not take into account a possible CIDR. --- .changelog/2486.txt | 3 +++ internal/sdkv2provider/schema_cloudflare_list.go | 5 ++--- internal/sdkv2provider/schema_cloudflare_list_item.go | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .changelog/2486.txt diff --git a/.changelog/2486.txt b/.changelog/2486.txt new file mode 100644 index 0000000000..a5ed26780b --- /dev/null +++ b/.changelog/2486.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/cloudflare_list: remove `IsIPAddress` validation that doesn't take into account CIDR notation +``` diff --git a/internal/sdkv2provider/schema_cloudflare_list.go b/internal/sdkv2provider/schema_cloudflare_list.go index 0d97af90c1..679bd5f7c2 100644 --- a/internal/sdkv2provider/schema_cloudflare_list.go +++ b/internal/sdkv2provider/schema_cloudflare_list.go @@ -53,9 +53,8 @@ var listItemElem = &schema.Resource{ Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ip": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.IsIPAddress, + Type: schema.TypeString, + Optional: true, }, "redirect": { Type: schema.TypeList, diff --git a/internal/sdkv2provider/schema_cloudflare_list_item.go b/internal/sdkv2provider/schema_cloudflare_list_item.go index b38e52d7a0..72b51173a2 100644 --- a/internal/sdkv2provider/schema_cloudflare_list_item.go +++ b/internal/sdkv2provider/schema_cloudflare_list_item.go @@ -33,6 +33,7 @@ func resourceCloudflareListItemSchema() map[string]*schema.Schema { Description: "Autonomous system number to include in the list", ExactlyOneOf: []string{"ip", "redirect", "hostname", "asn"}, ForceNew: true, + ValidateFunc: validation.IntAtLeast(1), }, "hostname": { Type: schema.TypeList,