From 454c41ffd8c10307709649ff9d79c9fe9e3ce2ba Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Thu, 27 Feb 2025 13:15:55 -0500 Subject: [PATCH 1/3] Add usage note to `PreferWriteOnlyAttribute` godocs --- boolvalidator/prefer_write_only_attribute.go | 3 +++ dynamicvalidator/prefer_write_only_attribute.go | 3 +++ float32validator/prefer_write_only_attribute.go | 3 +++ float64validator/prefer_write_only_attribute.go | 3 +++ int32validator/prefer_write_only_attribute.go | 3 +++ int64validator/prefer_write_only_attribute.go | 3 +++ listvalidator/prefer_write_only_attribute.go | 3 +++ mapvalidator/prefer_write_only_attribute.go | 3 +++ numbervalidator/prefer_write_only_attribute.go | 3 +++ objectvalidator/prefer_write_only_attribute.go | 3 +++ resourcevalidator/prefer_write_only_attribute.go | 3 +++ 11 files changed, 33 insertions(+) diff --git a/boolvalidator/prefer_write_only_attribute.go b/boolvalidator/prefer_write_only_attribute.go index 712c0a91..b07f8eef 100644 --- a/boolvalidator/prefer_write_only_attribute.go +++ b/boolvalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Bool { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/dynamicvalidator/prefer_write_only_attribute.go b/dynamicvalidator/prefer_write_only_attribute.go index 811d0f5b..92097784 100644 --- a/dynamicvalidator/prefer_write_only_attribute.go +++ b/dynamicvalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Dynamic { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/float32validator/prefer_write_only_attribute.go b/float32validator/prefer_write_only_attribute.go index b5ff8670..088e76ef 100644 --- a/float32validator/prefer_write_only_attribute.go +++ b/float32validator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Float32 { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/float64validator/prefer_write_only_attribute.go b/float64validator/prefer_write_only_attribute.go index 8882cf73..96e2cf61 100644 --- a/float64validator/prefer_write_only_attribute.go +++ b/float64validator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Float64 { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/int32validator/prefer_write_only_attribute.go b/int32validator/prefer_write_only_attribute.go index c064220d..689db218 100644 --- a/int32validator/prefer_write_only_attribute.go +++ b/int32validator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Int32 { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/int64validator/prefer_write_only_attribute.go b/int64validator/prefer_write_only_attribute.go index 3161328f..2cd384ce 100644 --- a/int64validator/prefer_write_only_attribute.go +++ b/int64validator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Int64 { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/listvalidator/prefer_write_only_attribute.go b/listvalidator/prefer_write_only_attribute.go index 50aba3b4..d549cece 100644 --- a/listvalidator/prefer_write_only_attribute.go +++ b/listvalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.List { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/mapvalidator/prefer_write_only_attribute.go b/mapvalidator/prefer_write_only_attribute.go index 8343ef41..679c58df 100644 --- a/mapvalidator/prefer_write_only_attribute.go +++ b/mapvalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Map { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/numbervalidator/prefer_write_only_attribute.go b/numbervalidator/prefer_write_only_attribute.go index 61285843..a287b0dd 100644 --- a/numbervalidator/prefer_write_only_attribute.go +++ b/numbervalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Number { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/objectvalidator/prefer_write_only_attribute.go b/objectvalidator/prefer_write_only_attribute.go index 71a8ac41..2db29392 100644 --- a/objectvalidator/prefer_write_only_attribute.go +++ b/objectvalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.Object { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute, diff --git a/resourcevalidator/prefer_write_only_attribute.go b/resourcevalidator/prefer_write_only_attribute.go index a2dcbec4..eda4c635 100644 --- a/resourcevalidator/prefer_write_only_attribute.go +++ b/resourcevalidator/prefer_write_only_attribute.go @@ -14,6 +14,9 @@ import ( // PreferWriteOnlyAttribute returns a warning if the Terraform client supports // write-only attributes, and the old attribute value is not null. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(oldAttribute path.Expression, writeOnlyAttribute path.Expression) resource.ConfigValidator { return preferWriteOnlyAttributeValidator{ oldAttribute: oldAttribute, From c7d0a1ecee71348b97116da888e30c42090f6f5d Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Thu, 27 Feb 2025 13:17:54 -0500 Subject: [PATCH 2/3] Remove `setvalidator.PreferWriteOnlyAttribute` entry from changelog --- .changes/0.17.0.md | 1 - CHANGELOG.md | 1 - 2 files changed, 2 deletions(-) diff --git a/.changes/0.17.0.md b/.changes/0.17.0.md index c7236745..e485f3e8 100644 --- a/.changes/0.17.0.md +++ b/.changes/0.17.0.md @@ -13,6 +13,5 @@ FEATURES: * numbervalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) * objectvalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) * resourcevalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) -* setvalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) * stringvalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84166193..006772e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,6 @@ FEATURES: * numbervalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) * objectvalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) * resourcevalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) -* setvalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) * stringvalidator: Added `PreferWriteOnlyAttribute` validator ([#263](https://github.com/hashicorp/terraform-plugin-framework-validators/issues/263)) ## 0.16.0 (December 12, 2024) From 59e94530f8e236a0a1288042d174ec44d1b27fdb Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Thu, 27 Feb 2025 13:21:55 -0500 Subject: [PATCH 3/3] Add godoc note to `stringvalidator` --- stringvalidator/prefer_write_only_attribute.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stringvalidator/prefer_write_only_attribute.go b/stringvalidator/prefer_write_only_attribute.go index 920546de..589f4b84 100644 --- a/stringvalidator/prefer_write_only_attribute.go +++ b/stringvalidator/prefer_write_only_attribute.go @@ -21,6 +21,9 @@ import ( // This implements the validation logic declaratively within the schema. // Refer to [resourcevalidator.PreferWriteOnlyAttribute] // for declaring this type of validation outside the schema definition. +// +// NOTE: This validator will produce persistent warnings for practitioners on every Terraform run as long as the specified non-write-only attribute +// has a value in the configuration. The validator will also produce warnings for users of shared modules who cannot immediately take action on the warning. func PreferWriteOnlyAttribute(writeOnlyAttribute path.Expression) validator.String { return schemavalidator.PreferWriteOnlyAttribute{ WriteOnlyAttribute: writeOnlyAttribute,