always evaluate outputs too

Always evaluate outputs during destroy, just like we did for locals.
This breaks existing tests, which we will handle separately.

Don't reverse output/local node evaluation order during destroy, as they
are both being evaluated.
This commit is contained in:
James Bardin 2018-01-29 18:02:59 -05:00
parent 7ac0a46981
commit 08139557f8
2 changed files with 6 additions and 7 deletions

View File

@ -83,19 +83,13 @@ func (n *NodeApplyableOutput) EvalTree() EvalNode {
}, },
}, },
&EvalOpFilter{ &EvalOpFilter{
Ops: []walkOperation{walkRefresh, walkPlan, walkApply, walkValidate}, Ops: []walkOperation{walkRefresh, walkPlan, walkApply, walkValidate, walkDestroy, walkPlanDestroy},
Node: &EvalWriteOutput{ Node: &EvalWriteOutput{
Name: n.Config.Name, Name: n.Config.Name,
Sensitive: n.Config.Sensitive, Sensitive: n.Config.Sensitive,
Value: n.Config.RawConfig, Value: n.Config.RawConfig,
}, },
}, },
&EvalOpFilter{
Ops: []walkOperation{walkDestroy, walkPlanDestroy},
Node: &EvalDeleteOutput{
Name: n.Config.Name,
},
},
}, },
} }
} }

View File

@ -96,6 +96,11 @@ func (t *DestroyValueReferenceTransformer) Transform(g *Graph) error {
// reverse any outgoing edges so that the value is evaluated first. // reverse any outgoing edges so that the value is evaluated first.
for _, e := range g.EdgesFrom(v) { for _, e := range g.EdgesFrom(v) {
target := e.Target() target := e.Target()
switch target.(type) {
case *NodeApplyableOutput, *NodeLocal:
// don't reverse other values
continue
}
log.Printf("[TRACE] output dep: %s", dag.VertexName(target)) log.Printf("[TRACE] output dep: %s", dag.VertexName(target))
g.RemoveEdge(e) g.RemoveEdge(e)