Skip to content

Commit

Permalink
Merge pull request #6922 from paybyphone/paybyphone_expanded_datasour…
Browse files Browse the repository at this point in the history
…ce_destroyfix

core: Ensure EvalReadDataApply is called on expanded destroy nodes
  • Loading branch information
jen20 committed May 29, 2016
2 parents a3a8b53 + 5597995 commit 4ca379f
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions terraform/transform_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 4ca379f

Please sign in to comment.