core: Instance/EvalDiff.Quiet -> Stub

Changed the language of this field to indicate that this diff is not a
"real" diff, in that it should not be acted on, versus a "quiet" mode,
which would indicate just simply to act silently.
This commit is contained in:
Chris Marchesi 2017-06-21 09:04:01 -07:00
parent eef933f2a7
commit 45528b2217
4 changed files with 14 additions and 11 deletions

View File

@ -100,8 +100,8 @@ func (h *CountHook) PostDiff(
return terraform.HookActionContinue, nil
}
// Don't count anything for a Quiet diff
if d.Quiet {
// Don't count anything for a Stub diff
if d.Stub {
return terraform.HookActionContinue, nil
}

View File

@ -374,10 +374,10 @@ type InstanceDiff struct {
// The value here must only contain Go primitives and collections.
Meta map[string]interface{}
// Quiet should be set when this diff exists only for purposes of providing a
// Stub should be set when this diff exists only for purposes of providing a
// diff to various pre-plan or dry-run steps in the graph. A diff with this
// enabled should not be acted on in the plan.
Quiet bool
Stub bool
}
func (d *InstanceDiff) Lock() { d.mu.Lock() }

View File

@ -82,10 +82,11 @@ type EvalDiff struct {
// filter user-requested ignored attributes from the diff.
Resource *config.Resource
// Quiet is used to indicate that this count should not be used in the UI.
// This is used with refresh nodes on scale-out so that resources do not get
// counted twice in the UI output.
Quiet bool
// Stub is used to flag the generated InstanceDiff as a stub. This is used to
// ensure that the node exists to perform interpolations and generate
// computed paths off of, but not as an actual diff where resouces should be
// counted, and not as a diff that should be acted on.
Stub bool
}
// TODO: test
@ -162,8 +163,10 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) {
return nil, err
}
// Flag quiet to ensure that this resource is skipped in post-diff hooks, such as count, etc.
diff.Quiet = n.Quiet
// Flag stub in the diff if set in the eval node. This ensures that this
// resource is skipped in post-diff hooks, such as count, etc, and is usually
// set in a pre-plan phase.
diff.Stub = n.Stub
// Call post-refresh hook
err = ctx.Hook(func(h Hook) (HookAction, error) {

View File

@ -234,7 +234,7 @@ func (n *NodeRefreshableManagedResourceInstance) evalTreeManagedScaleInResource(
Provider: &provider,
State: &state,
OutputState: &state,
Quiet: true,
Stub: true,
},
&EvalWriteState{
Name: stateID,