Skip to content

Commit

Permalink
fix: allowed ip range description fix for PGD
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-wong-edb committed Nov 14, 2024
1 parent c609e0f commit a14002f
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions pkg/plan_modifier/data_group_custom_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,6 @@ func (m CustomDataGroupDiffModifier) PlanModifyList(ctx context.Context, req pla
return
}

for _, pDg := range planDgsObs {
// 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(""),
}),
})
}
}

mapState := tfsdk.State{Schema: req.Plan.Schema, Raw: req.Plan.Raw}
diag = mapState.SetAttribute(ctx, path.Root("data_groups"), planDgsObs)
if diag.ErrorsCount() > 0 {
Expand Down

0 comments on commit a14002f

Please sign in to comment.