aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/terraform/eval_diff.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/terraform/eval_diff.go36
1 files changed, 24 insertions, 12 deletions
diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go b/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go
index 6f09526..c35f908 100644
--- a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go
+++ b/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go
@@ -81,6 +81,12 @@ type EvalDiff struct {
81 // Resource is needed to fetch the ignore_changes list so we can 81 // Resource is needed to fetch the ignore_changes list so we can
82 // filter user-requested ignored attributes from the diff. 82 // filter user-requested ignored attributes from the diff.
83 Resource *config.Resource 83 Resource *config.Resource
84
85 // Stub is used to flag the generated InstanceDiff as a stub. This is used to
86 // ensure that the node exists to perform interpolations and generate
87 // computed paths off of, but not as an actual diff where resouces should be
88 // counted, and not as a diff that should be acted on.
89 Stub bool
84} 90}
85 91
86// TODO: test 92// TODO: test
@@ -90,11 +96,13 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
90 provider := *n.Provider 96 provider := *n.Provider
91 97
92 // Call pre-diff hook 98 // Call pre-diff hook
93 err := ctx.Hook(func(h Hook) (HookAction, error) { 99 if !n.Stub {
94 return h.PreDiff(n.Info, state) 100 err := ctx.Hook(func(h Hook) (HookAction, error) {
95 }) 101 return h.PreDiff(n.Info, state)
96 if err != nil { 102 })
97 return nil, err 103 if err != nil {
104 return nil, err
105 }
98 } 106 }
99 107
100 // The state for the diff must never be nil 108 // The state for the diff must never be nil
@@ -158,15 +166,19 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
158 } 166 }
159 167
160 // Call post-refresh hook 168 // Call post-refresh hook
161 err = ctx.Hook(func(h Hook) (HookAction, error) { 169 if !n.Stub {
162 return h.PostDiff(n.Info, diff) 170 err = ctx.Hook(func(h Hook) (HookAction, error) {
163 }) 171 return h.PostDiff(n.Info, diff)
164 if err != nil { 172 })
165 return nil, err 173 if err != nil {
174 return nil, err
175 }
166 } 176 }
167 177
168 // Update our output 178 // Update our output if we care
169 *n.OutputDiff = diff 179 if n.OutputDiff != nil {
180 *n.OutputDiff = diff
181 }
170 182
171 // Update the state if we care 183 // Update the state if we care
172 if n.OutputState != nil { 184 if n.OutputState != nil {