From fa8766e3a1d09a4f72fba5c774bbda1583a9c9e7 Mon Sep 17 00:00:00 2001 From: Guinevere Saenger Date: Mon, 6 Jan 2025 12:52:49 -0800 Subject: [PATCH] Improve deprecation warning for Record.Value (#1015) In partial assist for https://github.com/pulumi/pulumi-cloudflare/issues/952. Due to not having a reliable repro of #952, we update the deprecation warning on Record.Value to be more explicit about updating to the new field. This pull request is blocked on the next bridge release as it needs changes from https://github.com/pulumi/pulumi-terraform-bridge/pull/2746. --- .../cmd/pulumi-resource-cloudflare/schema.json | 6 +++--- provider/resources.go | 12 +++++++++++- sdk/go/cloudflare/record.go | 12 ++++++------ .../main/java/com/pulumi/cloudflare/Record.java | 4 ++-- .../java/com/pulumi/cloudflare/RecordArgs.java | 16 ++++++++-------- .../pulumi/cloudflare/inputs/RecordState.java | 16 ++++++++-------- sdk/nodejs/record.ts | 6 +++--- sdk/python/pulumi_cloudflare/record.py | 14 +++++++------- 8 files changed, 48 insertions(+), 38 deletions(-) diff --git a/provider/cmd/pulumi-resource-cloudflare/schema.json b/provider/cmd/pulumi-resource-cloudflare/schema.json index 546bd8c4..648e6a1d 100644 --- a/provider/cmd/pulumi-resource-cloudflare/schema.json +++ b/provider/cmd/pulumi-resource-cloudflare/schema.json @@ -24425,7 +24425,7 @@ "value": { "type": "string", "description": "The value of the record. Must provide only one of `data`, `content`, `value`.\n", - "deprecationMessage": "`value` is deprecated in favour of `content` and will be removed in the next major release." + "deprecationMessage": "`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`." }, "zoneId": { "type": "string", @@ -24493,7 +24493,7 @@ "value": { "type": "string", "description": "The value of the record. Must provide only one of `data`, `content`, `value`.\n", - "deprecationMessage": "`value` is deprecated in favour of `content` and will be removed in the next major release." + "deprecationMessage": "`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`." }, "zoneId": { "type": "string", @@ -24579,7 +24579,7 @@ "value": { "type": "string", "description": "The value of the record. Must provide only one of `data`, `content`, `value`.\n", - "deprecationMessage": "`value` is deprecated in favour of `content` and will be removed in the next major release." + "deprecationMessage": "`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`." }, "zoneId": { "type": "string", diff --git a/provider/resources.go b/provider/resources.go index 910da6f9..2a011056 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -136,7 +136,17 @@ func Provider() info.Provider { // If `type` or `zoneId` is changed, then the resource will replace but the new // resource will conflict with the old one. To avoid this, we set // `DeleteBeforeReplace: true`. - "cloudflare_record": {DeleteBeforeReplace: true}, + "cloudflare_record": { + DeleteBeforeReplace: true, + Fields: map[string]*info.Schema{ + "value": { + DeprecationMessage: "`value` is deprecated in favour of `content` " + + "and will be removed in the next major release. " + + "Due to reports of inconsistent behavior on the `value` field, " + + "we strongly recommend migrating to `content`.", + }, + }, + }, "cloudflare_risk_behavior": {ComputeID: delegateID("accountId")}, "cloudflare_zero_trust_access_mtls_hostname_settings": {ComputeID: delegateID("accountId")}, diff --git a/sdk/go/cloudflare/record.go b/sdk/go/cloudflare/record.go index fe3575dc..0ec561e3 100644 --- a/sdk/go/cloudflare/record.go +++ b/sdk/go/cloudflare/record.go @@ -102,7 +102,7 @@ type Record struct { Type pulumi.StringOutput `pulumi:"type"` // The value of the record. Must provide only one of `data`, `content`, `value`. // - // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. + // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. Value pulumi.StringOutput `pulumi:"value"` // The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.** ZoneId pulumi.StringOutput `pulumi:"zoneId"` @@ -178,7 +178,7 @@ type recordState struct { Type *string `pulumi:"type"` // The value of the record. Must provide only one of `data`, `content`, `value`. // - // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. + // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. Value *string `pulumi:"value"` // The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.** ZoneId *string `pulumi:"zoneId"` @@ -216,7 +216,7 @@ type RecordState struct { Type pulumi.StringPtrInput // The value of the record. Must provide only one of `data`, `content`, `value`. // - // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. + // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. Value pulumi.StringPtrInput // The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.** ZoneId pulumi.StringPtrInput @@ -248,7 +248,7 @@ type recordArgs struct { Type string `pulumi:"type"` // The value of the record. Must provide only one of `data`, `content`, `value`. // - // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. + // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. Value *string `pulumi:"value"` // The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.** ZoneId string `pulumi:"zoneId"` @@ -277,7 +277,7 @@ type RecordArgs struct { Type pulumi.StringInput // The value of the record. Must provide only one of `data`, `content`, `value`. // - // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. + // Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. Value pulumi.StringPtrInput // The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.** ZoneId pulumi.StringInput @@ -446,7 +446,7 @@ func (o RecordOutput) Type() pulumi.StringOutput { // The value of the record. Must provide only one of `data`, `content`, `value`. // -// Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. +// Deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. func (o RecordOutput) Value() pulumi.StringOutput { return o.ApplyT(func(v *Record) pulumi.StringOutput { return v.Value }).(pulumi.StringOutput) } diff --git a/sdk/java/src/main/java/com/pulumi/cloudflare/Record.java b/sdk/java/src/main/java/com/pulumi/cloudflare/Record.java index f29821f0..385e0625 100644 --- a/sdk/java/src/main/java/com/pulumi/cloudflare/Record.java +++ b/sdk/java/src/main/java/com/pulumi/cloudflare/Record.java @@ -294,10 +294,10 @@ public Output type() { * The value of the record. Must provide only one of `data`, `content`, `value`. * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ @Export(name="value", refs={String.class}, tree="[0]") private Output value; diff --git a/sdk/java/src/main/java/com/pulumi/cloudflare/RecordArgs.java b/sdk/java/src/main/java/com/pulumi/cloudflare/RecordArgs.java index 2a323f61..ead52c68 100644 --- a/sdk/java/src/main/java/com/pulumi/cloudflare/RecordArgs.java +++ b/sdk/java/src/main/java/com/pulumi/cloudflare/RecordArgs.java @@ -166,10 +166,10 @@ public Output type() { * The value of the record. Must provide only one of `data`, `content`, `value`. * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ @Import(name="value") private @Nullable Output value; @@ -177,10 +177,10 @@ public Output type() { * @return The value of the record. Must provide only one of `data`, `content`, `value`. * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public Optional> value() { return Optional.ofNullable(this.value); } @@ -449,10 +449,10 @@ public Builder type(String type) { * @return builder * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public Builder value(@Nullable Output value) { $.value = value; return this; @@ -464,10 +464,10 @@ public Builder value(@Nullable Output value) { * @return builder * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public Builder value(String value) { return value(Output.of(value)); } diff --git a/sdk/java/src/main/java/com/pulumi/cloudflare/inputs/RecordState.java b/sdk/java/src/main/java/com/pulumi/cloudflare/inputs/RecordState.java index 218ee213..40750887 100644 --- a/sdk/java/src/main/java/com/pulumi/cloudflare/inputs/RecordState.java +++ b/sdk/java/src/main/java/com/pulumi/cloudflare/inputs/RecordState.java @@ -241,10 +241,10 @@ public Optional> type() { * The value of the record. Must provide only one of `data`, `content`, `value`. * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ @Import(name="value") private @Nullable Output value; @@ -252,10 +252,10 @@ public Optional> type() { * @return The value of the record. Must provide only one of `data`, `content`, `value`. * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public Optional> value() { return Optional.ofNullable(this.value); } @@ -634,10 +634,10 @@ public Builder type(String type) { * @return builder * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public Builder value(@Nullable Output value) { $.value = value; return this; @@ -649,10 +649,10 @@ public Builder value(@Nullable Output value) { * @return builder * * @deprecated - * `value` is deprecated in favour of `content` and will be removed in the next major release. + * `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. * */ - @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. */ + @Deprecated /* `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public Builder value(String value) { return value(Output.of(value)); } diff --git a/sdk/nodejs/record.ts b/sdk/nodejs/record.ts index 4abf36b2..703ca30c 100644 --- a/sdk/nodejs/record.ts +++ b/sdk/nodejs/record.ts @@ -134,7 +134,7 @@ export class Record extends pulumi.CustomResource { /** * The value of the record. Must provide only one of `data`, `content`, `value`. * - * @deprecated `value` is deprecated in favour of `content` and will be removed in the next major release. + * @deprecated `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ public readonly value!: pulumi.Output; /** @@ -270,7 +270,7 @@ export interface RecordState { /** * The value of the record. Must provide only one of `data`, `content`, `value`. * - * @deprecated `value` is deprecated in favour of `content` and will be removed in the next major release. + * @deprecated `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ value?: pulumi.Input; /** @@ -323,7 +323,7 @@ export interface RecordArgs { /** * The value of the record. Must provide only one of `data`, `content`, `value`. * - * @deprecated `value` is deprecated in favour of `content` and will be removed in the next major release. + * @deprecated `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`. */ value?: pulumi.Input; /** diff --git a/sdk/python/pulumi_cloudflare/record.py b/sdk/python/pulumi_cloudflare/record.py index 7b6d1641..6cc3f00d 100644 --- a/sdk/python/pulumi_cloudflare/record.py +++ b/sdk/python/pulumi_cloudflare/record.py @@ -67,8 +67,8 @@ def __init__(__self__, *, if ttl is not None: pulumi.set(__self__, "ttl", ttl) if value is not None: - warnings.warn("""`value` is deprecated in favour of `content` and will be removed in the next major release.""", DeprecationWarning) - pulumi.log.warn("""value is deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release.""") + warnings.warn("""`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""", DeprecationWarning) + pulumi.log.warn("""value is deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""") if value is not None: pulumi.set(__self__, "value", value) @@ -203,7 +203,7 @@ def ttl(self, value: Optional[pulumi.Input[int]]): @property @pulumi.getter - @_utilities.deprecated("""`value` is deprecated in favour of `content` and will be removed in the next major release.""") + @_utilities.deprecated("""`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""") def value(self) -> Optional[pulumi.Input[str]]: """ The value of the record. Must provide only one of `data`, `content`, `value`. @@ -285,8 +285,8 @@ def __init__(__self__, *, if type is not None: pulumi.set(__self__, "type", type) if value is not None: - warnings.warn("""`value` is deprecated in favour of `content` and will be removed in the next major release.""", DeprecationWarning) - pulumi.log.warn("""value is deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release.""") + warnings.warn("""`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""", DeprecationWarning) + pulumi.log.warn("""value is deprecated: `value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""") if value is not None: pulumi.set(__self__, "value", value) if zone_id is not None: @@ -471,7 +471,7 @@ def type(self, value: Optional[pulumi.Input[str]]): @property @pulumi.getter - @_utilities.deprecated("""`value` is deprecated in favour of `content` and will be removed in the next major release.""") + @_utilities.deprecated("""`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""") def value(self) -> Optional[pulumi.Input[str]]: """ The value of the record. Must provide only one of `data`, `content`, `value`. @@ -861,7 +861,7 @@ def type(self) -> pulumi.Output[str]: @property @pulumi.getter - @_utilities.deprecated("""`value` is deprecated in favour of `content` and will be removed in the next major release.""") + @_utilities.deprecated("""`value` is deprecated in favour of `content` and will be removed in the next major release. Due to reports of inconsistent behavior on the `value` field, we strongly recommend migrating to `content`.""") def value(self) -> pulumi.Output[str]: """ The value of the record. Must provide only one of `data`, `content`, `value`.