From e5aed3641dc2bc95c953807696cbbe683933084a Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Thu, 22 Feb 2024 16:36:31 +0800 Subject: [PATCH 1/2] azurerm_postgresql_flexible_server - update nil check for customer_managed_key --- .../services/postgres/postgresql_flexible_server_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/postgres/postgresql_flexible_server_resource.go b/internal/services/postgres/postgresql_flexible_server_resource.go index b59da096e91d..ac7c433512c6 100644 --- a/internal/services/postgres/postgresql_flexible_server_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_resource.go @@ -1091,7 +1091,7 @@ func flattenFlexibleServerAuthConfig(ac *servers.AuthConfig) interface{} { } func expandFlexibleServerDataEncryption(input []interface{}) *servers.DataEncryption { - if len(input) == 0 { + if len(input) == 0 || input[0] == nil { return nil } v := input[0].(map[string]interface{}) From 2cfa733012c4a14eeed17f2ae43d1abe611337fa Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Fri, 23 Feb 2024 08:08:46 +0800 Subject: [PATCH 2/2] update code --- .../services/postgres/postgresql_flexible_server_resource.go | 4 ++-- website/docs/r/postgresql_flexible_server.html.markdown | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/services/postgres/postgresql_flexible_server_resource.go b/internal/services/postgres/postgresql_flexible_server_resource.go index ac7c433512c6..267c72ac82bf 100644 --- a/internal/services/postgres/postgresql_flexible_server_resource.go +++ b/internal/services/postgres/postgresql_flexible_server_resource.go @@ -279,7 +279,7 @@ func resourcePostgresqlFlexibleServer() *pluginsdk.Resource { Schema: map[string]*pluginsdk.Schema{ "key_vault_key_id": { Type: pluginsdk.TypeString, - Optional: true, + Required: true, ValidateFunc: keyVaultValidate.NestedItemIdWithOptionalVersion, RequiredWith: []string{ "identity", @@ -1091,7 +1091,7 @@ func flattenFlexibleServerAuthConfig(ac *servers.AuthConfig) interface{} { } func expandFlexibleServerDataEncryption(input []interface{}) *servers.DataEncryption { - if len(input) == 0 || input[0] == nil { + if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) diff --git a/website/docs/r/postgresql_flexible_server.html.markdown b/website/docs/r/postgresql_flexible_server.html.markdown index 89b5ed79ec39..26d1deb4e700 100644 --- a/website/docs/r/postgresql_flexible_server.html.markdown +++ b/website/docs/r/postgresql_flexible_server.html.markdown @@ -165,7 +165,7 @@ An `authentication` block supports the following: A `customer_managed_key` block supports the following: -* `key_vault_key_id` - (Optional) The ID of the Key Vault Key. +* `key_vault_key_id` - (Required) The ID of the Key Vault Key. * `primary_user_assigned_identity_id` - (Optional) Specifies the primary user managed identity id for a Customer Managed Key. Should be added with `identity_ids`.