Skip to content

Commit

Permalink
fix: tde plan fix and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-wong-edb committed Aug 1, 2024
1 parent d8ae409 commit 8ec54b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/plan_modifier/transparent_data_encryption_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 4 additions & 5 deletions pkg/provider/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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(),
},
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8ec54b1

Please sign in to comment.