From 8ec54b14bde728b09a8a7184621e90c9d4d64bb4 Mon Sep 17 00:00:00 2001 From: "PC-2NR0VQ3\\wai.wong" Date: Thu, 1 Aug 2024 21:45:54 +0100 Subject: [PATCH] fix: tde plan fix and minor fixes --- pkg/plan_modifier/transparent_data_encryption_action.go | 2 +- pkg/provider/resource_cluster.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/plan_modifier/transparent_data_encryption_action.go b/pkg/plan_modifier/transparent_data_encryption_action.go index 69b8e3b2..eda4f26d 100644 --- a/pkg/plan_modifier/transparent_data_encryption_action.go +++ b/pkg/plan_modifier/transparent_data_encryption_action.go @@ -51,7 +51,7 @@ func (m CustomTDEActionModifier) PlanModifyString(ctx context.Context, req planm } // transparent_data_encryption doesn't exist. tde action should be null - if !planObject["transparent_data_encryption"].IsKnown() { + if planObject["transparent_data_encryption"].IsNull() { resp.PlanValue = basetypes.NewStringNull() return } diff --git a/pkg/provider/resource_cluster.go b/pkg/provider/resource_cluster.go index 6b7a64de..74b48283 100644 --- a/pkg/provider/resource_cluster.go +++ b/pkg/provider/resource_cluster.go @@ -443,13 +443,11 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest "pgvector": schema.BoolAttribute{ MarkdownDescription: "Is pgvector extension enabled. Adds support for vector storage and vector similarity search to Postgres.", Optional: true, - Computed: true, PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()}, }, "post_gis": schema.BoolAttribute{ MarkdownDescription: "Is postGIS extension enabled. PostGIS extends the capabilities of the PostgreSQL relational database by adding support storing, indexing and querying geographic data.", Optional: true, - Computed: true, PlanModifiers: []planmodifier.Bool{boolplanmodifier.UseStateForUnknown()}, }, "pg_bouncer": schema.SingleNestedAttribute{ @@ -501,7 +499,6 @@ func (c *clusterResource) Schema(ctx context.Context, req resource.SchemaRequest "transparent_data_encryption": schema.SingleNestedAttribute{ MarkdownDescription: "Transparent Data Encryption (TDE) key", Optional: true, - Computed: true, PlanModifiers: []planmodifier.Object{ objectplanmodifier.UseStateForUnknown(), }, @@ -1123,8 +1120,10 @@ func (c *clusterResource) generateGenericClusterModel(ctx context.Context, clust cluster.ServiceAccountIds = svAccIds cluster.PeAllowedPrincipalIds = principalIds - if !clusterResource.TransparentDataEncryption.KeyId.IsNull() { - cluster.EncryptionKeyIdReq = clusterResource.TransparentDataEncryption.KeyId.ValueStringPointer() + if clusterResource.TransparentDataEncryption != nil { + if !clusterResource.TransparentDataEncryption.KeyId.IsNull() { + cluster.EncryptionKeyIdReq = clusterResource.TransparentDataEncryption.KeyId.ValueStringPointer() + } } return cluster, nil