fix output transformer names

The removeRootOutputs field was not strictly used for that purpose, and
was also copied to another DestroyPlan field.
This commit is contained in:
James Bardin 2022-10-19 15:15:40 -04:00
parent 47b6386348
commit 1eb22fd94a
3 changed files with 12 additions and 12 deletions

View File

@ -97,7 +97,7 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer {
&LocalTransformer{Config: b.Config},
&OutputTransformer{
Config: b.Config,
destroyApply: b.Operation == walkDestroy,
DestroyApply: b.Operation == walkDestroy,
},
// Creates all the resource instances represented in the diff, along

View File

@ -110,9 +110,9 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer {
&ModuleVariableTransformer{Config: b.Config},
&LocalTransformer{Config: b.Config},
&OutputTransformer{
Config: b.Config,
RefreshOnly: b.skipPlanChanges,
removeRootOutputs: b.Operation == walkPlanDestroy,
Config: b.Config,
RefreshOnly: b.skipPlanChanges,
DestroyPlan: b.Operation == walkPlanDestroy,
// NOTE: We currently treat anything built with the plan graph
// builder as "planning" for our purposes here, because we share

View File

@ -16,10 +16,6 @@ import (
type OutputTransformer struct {
Config *configs.Config
// If this is a planned destroy, root outputs are still in the configuration
// so we need to record that we wish to remove them
removeRootOutputs bool
// Refresh-only mode means that any failing output preconditions are
// reported as warnings rather than errors
RefreshOnly bool
@ -28,9 +24,13 @@ type OutputTransformer struct {
// It must be set to false whenever we're building an apply graph.
Planning bool
// destroyApply indicates that this is being added to an apply graph, which
// If this is a planned destroy, root outputs are still in the configuration
// so we need to record that we wish to remove them
DestroyPlan bool
// DestroyApply indicates that this is being added to an apply graph, which
// is the result of a destroy plan.
destroyApply bool
DestroyApply bool
}
func (t *OutputTransformer) Transform(g *Graph) error {
@ -59,8 +59,8 @@ func (t *OutputTransformer) transform(g *Graph, c *configs.Config) error {
Addr: addr,
Module: c.Path,
Config: o,
DestroyPlan: t.removeRootOutputs,
DestroyApply: t.destroyApply,
DestroyPlan: t.DestroyPlan,
DestroyApply: t.DestroyApply,
RefreshOnly: t.RefreshOnly,
Planning: t.Planning,
}