Merge pull request #6922 from paybyphone/paybyphone_expanded_datasource_destroyfix

core: Ensure EvalReadDataApply is called on expanded destroy nodes
This commit is contained in:
James Nugent 2016-05-29 11:55:57 -07:00
commit 4ca379f3c7

View File

@ -894,7 +894,23 @@ func (n *graphNodeExpandedResourceDestroy) EvalTree() EvalNode {
&EvalRequireState{ &EvalRequireState{
State: &state, State: &state,
}, },
&EvalApply{ // Make sure we handle data sources properly.
&EvalIf{
If: func(ctx EvalContext) (bool, error) {
if n.Resource.Mode == config.DataResourceMode {
return true, nil
}
return false, nil
},
Then: &EvalReadDataApply{
Info: info,
Diff: &diffApply,
Provider: &provider,
Output: &state,
},
Else: &EvalApply{
Info: info, Info: info,
State: &state, State: &state,
Diff: &diffApply, Diff: &diffApply,
@ -902,6 +918,7 @@ func (n *graphNodeExpandedResourceDestroy) EvalTree() EvalNode {
Output: &state, Output: &state,
Error: &err, Error: &err,
}, },
},
&EvalWriteState{ &EvalWriteState{
Name: n.stateId(), Name: n.stateId(),
ResourceType: n.Resource.Type, ResourceType: n.Resource.Type,