Merge pull request #30471 from hashicorp/alisdair/what-even-is-validate

core: Remove unused PlanOpts.Validate
This commit is contained in:
Alisdair McDiarmid 2022-02-04 08:21:09 -05:00 committed by GitHub
commit d1ac8b71d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 13 deletions

View File

@ -462,7 +462,7 @@ func (c *Context) planWalk(config *configs.Config, prevRunState *states.State, o
return nil, diags
}
graph, walkOp, moreDiags := c.planGraph(config, prevRunState, opts, true)
graph, walkOp, moreDiags := c.planGraph(config, prevRunState, opts)
diags = diags.Append(moreDiags)
if diags.HasErrors() {
return nil, diags
@ -517,7 +517,7 @@ func (c *Context) planWalk(config *configs.Config, prevRunState *states.State, o
return plan, diags
}
func (c *Context) planGraph(config *configs.Config, prevRunState *states.State, opts *PlanOpts, validate bool) (*Graph, walkOperation, tfdiags.Diagnostics) {
func (c *Context) planGraph(config *configs.Config, prevRunState *states.State, opts *PlanOpts) (*Graph, walkOperation, tfdiags.Diagnostics) {
switch mode := opts.Mode; mode {
case plans.NormalMode:
graph, diags := (&PlanGraphBuilder{
@ -527,7 +527,6 @@ func (c *Context) planGraph(config *configs.Config, prevRunState *states.State,
Plugins: c.plugins,
Targets: opts.Targets,
ForceReplace: opts.ForceReplace,
Validate: validate,
skipRefresh: opts.SkipRefresh,
}).Build(addrs.RootModuleInstance)
return graph, walkPlan, diags
@ -538,7 +537,6 @@ func (c *Context) planGraph(config *configs.Config, prevRunState *states.State,
RootVariableValues: opts.SetVariables,
Plugins: c.plugins,
Targets: opts.Targets,
Validate: validate,
skipRefresh: opts.SkipRefresh,
skipPlanChanges: true, // this activates "refresh only" mode.
}).Build(addrs.RootModuleInstance)
@ -550,7 +548,6 @@ func (c *Context) planGraph(config *configs.Config, prevRunState *states.State,
RootVariableValues: opts.SetVariables,
Plugins: c.plugins,
Targets: opts.Targets,
Validate: validate,
skipRefresh: opts.SkipRefresh,
}).Build(addrs.RootModuleInstance)
return graph, walkPlanDestroy, diags
@ -714,7 +711,7 @@ func (c *Context) PlanGraphForUI(config *configs.Config, prevRunState *states.St
opts := &PlanOpts{Mode: mode}
graph, _, moreDiags := c.planGraph(config, prevRunState, opts, false)
graph, _, moreDiags := c.planGraph(config, prevRunState, opts)
diags = diags.Append(moreDiags)
return graph, diags
}

View File

@ -58,7 +58,6 @@ func (c *Context) Validate(config *configs.Config) tfdiags.Diagnostics {
graph, moreDiags := ValidateGraphBuilder(&PlanGraphBuilder{
Config: config,
Plugins: c.plugins,
Validate: true,
State: states.NewState(),
RootVariableValues: varValues,
}).Build(addrs.RootModuleInstance)

View File

@ -45,9 +45,6 @@ type PlanGraphBuilder struct {
// action instead. Create and Delete actions are not affected.
ForceReplace []addrs.AbsResourceInstance
// Validate will do structural validation of the graph.
Validate bool
// skipRefresh indicates that we should skip refreshing managed resources
skipRefresh bool
@ -72,9 +69,8 @@ type PlanGraphBuilder struct {
// See GraphBuilder
func (b *PlanGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics) {
return (&BasicGraphBuilder{
Steps: b.Steps(),
Validate: b.Validate,
Name: "PlanGraphBuilder",
Steps: b.Steps(),
Name: "PlanGraphBuilder",
}).Build(path)
}