From a14002ff92cd564b434dee434aef31eefd585a04 Mon Sep 17 00:00:00 2001 From: "PC-2NR0VQ3\\wai.wong" Date: Thu, 14 Nov 2024 09:51:18 +0000 Subject: [PATCH] fix: allowed ip range description fix for PGD --- pkg/plan_modifier/data_group_custom_diff.go | 24 --------------------- 1 file changed, 24 deletions(-) diff --git a/pkg/plan_modifier/data_group_custom_diff.go b/pkg/plan_modifier/data_group_custom_diff.go index 0df65780..8da0e977 100644 --- a/pkg/plan_modifier/data_group_custom_diff.go +++ b/pkg/plan_modifier/data_group_custom_diff.go @@ -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 {