Skip to content

Commit d928925

Browse files
committed
fix immutability
1 parent db68555 commit d928925

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

internal/fwserver/server_planresourcechange.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -325,21 +325,24 @@ func (s *Server) PlanResourceChange(ctx context.Context, req *PlanResourceChange
325325
modifyPlanReq.ProviderMeta = *req.ProviderMeta
326326
}
327327

328-
if resp.PlannedIdentity != nil {
329-
modifyPlanReq.Identity = &tfsdk.ResourceIdentity{
330-
Schema: resp.PlannedIdentity.Schema,
331-
Raw: resp.PlannedIdentity.Raw.Copy(),
332-
}
333-
}
334-
335328
modifyPlanResp := resource.ModifyPlanResponse{
336329
Diagnostics: resp.Diagnostics,
337330
Plan: modifyPlanReq.Plan,
338-
Identity: modifyPlanReq.Identity,
339331
RequiresReplace: path.Paths{},
340332
Private: modifyPlanReq.Private,
341333
}
342334

335+
if resp.PlannedIdentity != nil {
336+
modifyPlanReq.Identity = &tfsdk.ResourceIdentity{
337+
Schema: resp.PlannedIdentity.Schema,
338+
Raw: resp.PlannedIdentity.Raw.Copy(),
339+
}
340+
modifyPlanResp.Identity = &tfsdk.ResourceIdentity{
341+
Schema: resp.PlannedIdentity.Schema,
342+
Raw: resp.PlannedIdentity.Raw.Copy(),
343+
}
344+
}
345+
343346
logging.FrameworkTrace(ctx, "Calling provider defined Resource ModifyPlan")
344347
resourceWithModifyPlan.ModifyPlan(ctx, modifyPlanReq, &modifyPlanResp)
345348
logging.FrameworkTrace(ctx, "Called provider defined Resource ModifyPlan")

0 commit comments

Comments
 (0)