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
1 changed files with 24 additions and 7 deletions

View File

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