diff --git a/internal/terraform/node_resource_apply_instance.go b/internal/terraform/node_resource_apply_instance.go index be6531924005..82aebec296c4 100644 --- a/internal/terraform/node_resource_apply_instance.go +++ b/internal/terraform/node_resource_apply_instance.go @@ -271,7 +271,7 @@ func (n *NodeApplyableResourceInstance) managedResourceExecute(ctx EvalContext) // Make a new diff, in case we've learned new values in the state // during apply which we can now incorporate. - diffApply, _, _, planDiags := n.plan(ctx, diff, state, false, n.forceReplace) + diffApply, _, repeatData, planDiags := n.plan(ctx, diff, state, false, n.forceReplace) diags = diags.Append(planDiags) if diags.HasErrors() { return diags @@ -296,12 +296,6 @@ func (n *NodeApplyableResourceInstance) managedResourceExecute(ctx EvalContext) return diags } - var repeatData instances.RepetitionData - if n.Config != nil { - forEach, _ := evaluateForEachExpression(n.Config.ForEach, ctx) - repeatData = EvalDataForInstanceKey(n.ResourceInstanceAddr().Resource.Key, forEach) - } - // If there is no change, there was nothing to apply, and we don't need to // re-write the state, but we do need to re-evaluate postconditions. if diffApply.Action == plans.NoOp {