From f222ed74799e969cead36f87bce699ac24aa13bd Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 21 Sep 2020 09:36:50 -0400 Subject: [PATCH] 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. --- terraform/node_output.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/terraform/node_output.go b/terraform/node_output.go index 51eb7e1568..8423931fd9 100644 --- a/terraform/node_output.go +++ b/terraform/node_output.go @@ -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