Skip to content

Commit 41190b2

Browse files
authored
internal/fwserver: Remove old multiple pass code comments in PlanResourceChange logic (#798)
Reference: #183 When plan modification logic was introduced into the framework, it was not clear whether a multiple pass approach to running provider logic would be necessary. After thorough investigation, the multiple pass approach was instead replaced with explicit attribute default functionality to cover the main use case for such an approach, but the code comments were not removed when that was completed. To prevent future maintainer confusion, this is removing the old code comments.
1 parent a46d263 commit 41190b2

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

internal/fwserver/server_planresourcechange.go

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -133,47 +133,6 @@ func (s *Server) PlanResourceChange(ctx context.Context, req *PlanResourceChange
133133
resp.PlannedState.Raw = data.TerraformValue
134134
}
135135

136-
// Execute any AttributePlanModifiers.
137-
//
138-
// This pass is before any Computed-only attributes are marked as unknown
139-
// to ensure any plan changes will trigger that behavior. These plan
140-
// modifiers are run again after that marking to allow setting values
141-
// and preventing extraneous plan differences.
142-
//
143-
// We only do this if there's a plan to modify; otherwise, it
144-
// represents a resource being deleted and there's no point.
145-
//
146-
// TODO: Enabling this pass will generate the following test error:
147-
//
148-
// --- FAIL: TestServerPlanResourceChange/two_modifyplan_add_list_elem (0.00s)
149-
// serve_test.go:3303: An unexpected error was encountered trying to read an attribute from the configuration. This is always an error in the provider. Please report the following to the provider developer:
150-
//
151-
// ElementKeyInt(1).AttributeName("name") still remains in the path: step cannot be applied to this value
152-
//
153-
// To fix this, (Config).GetAttribute() should return nil instead of the error.
154-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/183
155-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/150
156-
// See also: https://github.com/hashicorp/terraform-plugin-framework/pull/167
157-
158-
// Execute any resource-level ModifyPlan method.
159-
//
160-
// This pass is before any Computed-only attributes are marked as unknown
161-
// to ensure any plan changes will trigger that behavior. These plan
162-
// modifiers be run again after that marking to allow setting values and
163-
// preventing extraneous plan differences.
164-
//
165-
// TODO: Enabling this pass will generate the following test error:
166-
//
167-
// --- FAIL: TestServerPlanResourceChange/two_modifyplan_add_list_elem (0.00s)
168-
// serve_test.go:3303: An unexpected error was encountered trying to read an attribute from the configuration. This is always an error in the provider. Please report the following to the provider developer:
169-
//
170-
// ElementKeyInt(1).AttributeName("name") still remains in the path: step cannot be applied to this value
171-
//
172-
// To fix this, (Config).GetAttribute() should return nil instead of the error.
173-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/183
174-
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/150
175-
// See also: https://github.com/hashicorp/terraform-plugin-framework/pull/167
176-
177136
// After ensuring there are proposed changes, mark any computed attributes
178137
// that are null in the config as unknown in the plan, so providers have
179138
// the choice to update them.
@@ -253,7 +212,7 @@ func (s *Server) PlanResourceChange(ctx context.Context, req *PlanResourceChange
253212
resp.PlannedState.Raw = modifiedPlan
254213
}
255214

256-
// Execute any AttributePlanModifiers again. This allows overwriting
215+
// Execute any schema-based plan modifiers. This allows overwriting
257216
// any unknown values.
258217
//
259218
// We only do this if there's a plan to modify; otherwise, it
@@ -288,7 +247,7 @@ func (s *Server) PlanResourceChange(ctx context.Context, req *PlanResourceChange
288247
}
289248
}
290249

291-
// Execute any resource-level ModifyPlan method again. This allows
250+
// Execute any resource-level ModifyPlan method. This allows
292251
// overwriting any unknown values.
293252
//
294253
// We do this regardless of whether the plan is null or not, because we

0 commit comments

Comments
 (0)