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{
State: &state,
},
&EvalApply{
Info: info,
State: &state,
Diff: &diffApply,
Provider: &provider,
Output: &state,
Error: &err,
// 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,
State: &state,
Diff: &diffApply,
Provider: &provider,
Output: &state,
Error: &err,
},
},
&EvalWriteState{
Name: n.stateId(),