Skip to content

Commit

Permalink
fix: ip description remove
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-wong-edb committed Nov 26, 2024
1 parent 81f7e12 commit ea27bf0
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions pkg/plan_modifier/data_group_custom_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"reflect"

"github.com/EnterpriseDB/terraform-provider-biganimal/pkg/models/pgd/terraform"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/tfsdk"
Expand Down Expand Up @@ -102,28 +101,6 @@ func (m CustomDataGroupDiffModifier) PlanModifyList(ctx context.Context, req pla
pDg.Storage.Iops = sDg.Storage.Iops
pDg.Storage.Throughput = sDg.Storage.Throughput

// fix to set the correct allowed ip ranges to allow all if a PGD data group has private networking set as true
if pDg.PrivateNetworking != nil && *pDg.PrivateNetworking {
pDg.AllowedIpRanges = types.SetValueMust(pDg.AllowedIpRanges.ElementType(ctx), []attr.Value{
types.ObjectValueMust(
pDg.AllowedIpRanges.ElementType(ctx).(types.ObjectType).AttributeTypes(),
map[string]attr.Value{
"cidr_block": types.StringValue("0.0.0.0/0"),
"description": types.StringValue("To allow all access"),
}),
})
// fix to set the correct allowed ip ranges for PGD data group if allowed ip ranges length is 0
} else if pDg.AllowedIpRanges.IsNull() || len(pDg.AllowedIpRanges.Elements()) == 0 {
pDg.AllowedIpRanges = types.SetValueMust(pDg.AllowedIpRanges.ElementType(ctx), []attr.Value{
types.ObjectValueMust(
pDg.AllowedIpRanges.ElementType(ctx).(types.ObjectType).AttributeTypes(),
map[string]attr.Value{
"cidr_block": types.StringValue("0.0.0.0/0"),
"description": types.StringValue(""),
}),
})
}

// if private networking has change then connection string will change
if sDg.PrivateNetworking != pDg.PrivateNetworking {
pDg.Connection = types.StringUnknown()
Expand Down

0 comments on commit ea27bf0

Please sign in to comment.