write updated outputs to the refresh state

If we can evaluate a new output value during plan, write it to the
refreshed state as well.
This commit is contained in:
James Bardin 2020-09-21 09:36:50 -04:00
parent 7951b55f88
commit f222ed7479
1 changed files with 7 additions and 0 deletions

View File

@ -230,6 +230,13 @@ func (n *NodeApplyableOutput) Execute(ctx EvalContext, op walkOperation) error {
return diags.Err()
}
n.setValue(state, changes, val)
// If we were able to evaluate a new value, we can update that in the
// refreshed state as well.
if state = ctx.RefreshState(); state != nil && val.IsWhollyKnown() {
n.setValue(state, changes, val)
}
return nil
default:
return nil