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}, &LocalTransformer{Config: b.Config},
&OutputTransformer{ &OutputTransformer{
Config: b.Config, Config: b.Config,
destroyApply: b.Operation == walkDestroy, DestroyApply: b.Operation == walkDestroy,
}, },
// Creates all the resource instances represented in the diff, along // 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}, &ModuleVariableTransformer{Config: b.Config},
&LocalTransformer{Config: b.Config}, &LocalTransformer{Config: b.Config},
&OutputTransformer{ &OutputTransformer{
Config: b.Config, Config: b.Config,
RefreshOnly: b.skipPlanChanges, RefreshOnly: b.skipPlanChanges,
removeRootOutputs: b.Operation == walkPlanDestroy, DestroyPlan: b.Operation == walkPlanDestroy,
// NOTE: We currently treat anything built with the plan graph // NOTE: We currently treat anything built with the plan graph
// builder as "planning" for our purposes here, because we share // builder as "planning" for our purposes here, because we share

View File

@ -16,10 +16,6 @@ import (
type OutputTransformer struct { type OutputTransformer struct {
Config *configs.Config 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 // Refresh-only mode means that any failing output preconditions are
// reported as warnings rather than errors // reported as warnings rather than errors
RefreshOnly bool RefreshOnly bool
@ -28,9 +24,13 @@ type OutputTransformer struct {
// It must be set to false whenever we're building an apply graph. // It must be set to false whenever we're building an apply graph.
Planning bool 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. // is the result of a destroy plan.
destroyApply bool DestroyApply bool
} }
func (t *OutputTransformer) Transform(g *Graph) error { func (t *OutputTransformer) Transform(g *Graph) error {
@ -59,8 +59,8 @@ func (t *OutputTransformer) transform(g *Graph, c *configs.Config) error {
Addr: addr, Addr: addr,
Module: c.Path, Module: c.Path,
Config: o, Config: o,
DestroyPlan: t.removeRootOutputs, DestroyPlan: t.DestroyPlan,
DestroyApply: t.destroyApply, DestroyApply: t.DestroyApply,
RefreshOnly: t.RefreshOnly, RefreshOnly: t.RefreshOnly,
Planning: t.Planning, Planning: t.Planning,
} }