use key data from plan method for apply

This commit is contained in:
James Bardin 2022-10-31 11:00:07 -04:00
parent ffe2e3935e
commit efd77159dd

View File

@ -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 {