From 25ec7c10309495660301993d03e42d24607fcab1 Mon Sep 17 00:00:00 2001 From: Mike Girouard Date: Sat, 17 Aug 2024 23:58:24 -0400 Subject: [PATCH 1/2] Safely deprecate value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch follows up #3590 by allowing `value` to continue be set while still preserving it's deprecated status. `value` and `content` are mutually exclusive. Setting both will return an error. │ Error: 'content' (present: true) must not be set with 'value' (present: true) No state changes will take place when replacing `value` with `content` provided the value is identical. --- internal/sdkv2provider/resource_cloudflare_record.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/sdkv2provider/resource_cloudflare_record.go b/internal/sdkv2provider/resource_cloudflare_record.go index 9851980f91..5f45047a65 100644 --- a/internal/sdkv2provider/resource_cloudflare_record.go +++ b/internal/sdkv2provider/resource_cloudflare_record.go @@ -71,6 +71,15 @@ func resourceCloudflareRecordCreate(ctx context.Context, d *schema.ResourceData, newRecord.Content = content.(string) } + if contentOk == valueOk { + return diag.FromErr(fmt.Errorf( + "'content' (present: %t) must not be set with 'value' (present: %t)", + contentOk, valueOk)) + } + if valueOk { + contentOk = true + } + data, dataOk := d.GetOk("data") tflog.Debug(ctx, fmt.Sprintf("Data found in config: %#v", data)) From 77944f3aa15908c27adfda26744e61637e213020 Mon Sep 17 00:00:00 2001 From: Mike Girouard Date: Sun, 18 Aug 2024 00:44:47 -0400 Subject: [PATCH 2/2] Add changelog entry --- .changelog/3674.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/3674.txt diff --git a/.changelog/3674.txt b/.changelog/3674.txt new file mode 100644 index 0000000000..9c2e8ccf57 --- /dev/null +++ b/.changelog/3674.txt @@ -0,0 +1,3 @@ +```release-note:note +resource/cloudflare_record: fix a bug that prematurely removed the ability to set the deprecated `value` field. +```