Merge pull request #30471 from hashicorp/alisdair/what-even-is-validate
core: Remove unused PlanOpts.Validate
This commit is contained in:
commit
d1ac8b71d4
|
@ -462,7 +462,7 @@ func (c *Context) planWalk(config *configs.Config, prevRunState *states.State, o
|
||||||
return nil, diags
|
return nil, diags
|
||||||
}
|
}
|
||||||
|
|
||||||
graph, walkOp, moreDiags := c.planGraph(config, prevRunState, opts, true)
|
graph, walkOp, moreDiags := c.planGraph(config, prevRunState, opts)
|
||||||
diags = diags.Append(moreDiags)
|
diags = diags.Append(moreDiags)
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
return nil, diags
|
return nil, diags
|
||||||
|
@ -517,7 +517,7 @@ func (c *Context) planWalk(config *configs.Config, prevRunState *states.State, o
|
||||||
return plan, diags
|
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 {
|
switch mode := opts.Mode; mode {
|
||||||
case plans.NormalMode:
|
case plans.NormalMode:
|
||||||
graph, diags := (&PlanGraphBuilder{
|
graph, diags := (&PlanGraphBuilder{
|
||||||
|
@ -527,7 +527,6 @@ func (c *Context) planGraph(config *configs.Config, prevRunState *states.State,
|
||||||
Plugins: c.plugins,
|
Plugins: c.plugins,
|
||||||
Targets: opts.Targets,
|
Targets: opts.Targets,
|
||||||
ForceReplace: opts.ForceReplace,
|
ForceReplace: opts.ForceReplace,
|
||||||
Validate: validate,
|
|
||||||
skipRefresh: opts.SkipRefresh,
|
skipRefresh: opts.SkipRefresh,
|
||||||
}).Build(addrs.RootModuleInstance)
|
}).Build(addrs.RootModuleInstance)
|
||||||
return graph, walkPlan, diags
|
return graph, walkPlan, diags
|
||||||
|
@ -538,7 +537,6 @@ func (c *Context) planGraph(config *configs.Config, prevRunState *states.State,
|
||||||
RootVariableValues: opts.SetVariables,
|
RootVariableValues: opts.SetVariables,
|
||||||
Plugins: c.plugins,
|
Plugins: c.plugins,
|
||||||
Targets: opts.Targets,
|
Targets: opts.Targets,
|
||||||
Validate: validate,
|
|
||||||
skipRefresh: opts.SkipRefresh,
|
skipRefresh: opts.SkipRefresh,
|
||||||
skipPlanChanges: true, // this activates "refresh only" mode.
|
skipPlanChanges: true, // this activates "refresh only" mode.
|
||||||
}).Build(addrs.RootModuleInstance)
|
}).Build(addrs.RootModuleInstance)
|
||||||
|
@ -550,7 +548,6 @@ func (c *Context) planGraph(config *configs.Config, prevRunState *states.State,
|
||||||
RootVariableValues: opts.SetVariables,
|
RootVariableValues: opts.SetVariables,
|
||||||
Plugins: c.plugins,
|
Plugins: c.plugins,
|
||||||
Targets: opts.Targets,
|
Targets: opts.Targets,
|
||||||
Validate: validate,
|
|
||||||
skipRefresh: opts.SkipRefresh,
|
skipRefresh: opts.SkipRefresh,
|
||||||
}).Build(addrs.RootModuleInstance)
|
}).Build(addrs.RootModuleInstance)
|
||||||
return graph, walkPlanDestroy, diags
|
return graph, walkPlanDestroy, diags
|
||||||
|
@ -714,7 +711,7 @@ func (c *Context) PlanGraphForUI(config *configs.Config, prevRunState *states.St
|
||||||
|
|
||||||
opts := &PlanOpts{Mode: mode}
|
opts := &PlanOpts{Mode: mode}
|
||||||
|
|
||||||
graph, _, moreDiags := c.planGraph(config, prevRunState, opts, false)
|
graph, _, moreDiags := c.planGraph(config, prevRunState, opts)
|
||||||
diags = diags.Append(moreDiags)
|
diags = diags.Append(moreDiags)
|
||||||
return graph, diags
|
return graph, diags
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@ func (c *Context) Validate(config *configs.Config) tfdiags.Diagnostics {
|
||||||
graph, moreDiags := ValidateGraphBuilder(&PlanGraphBuilder{
|
graph, moreDiags := ValidateGraphBuilder(&PlanGraphBuilder{
|
||||||
Config: config,
|
Config: config,
|
||||||
Plugins: c.plugins,
|
Plugins: c.plugins,
|
||||||
Validate: true,
|
|
||||||
State: states.NewState(),
|
State: states.NewState(),
|
||||||
RootVariableValues: varValues,
|
RootVariableValues: varValues,
|
||||||
}).Build(addrs.RootModuleInstance)
|
}).Build(addrs.RootModuleInstance)
|
||||||
|
|
|
@ -45,9 +45,6 @@ type PlanGraphBuilder struct {
|
||||||
// action instead. Create and Delete actions are not affected.
|
// action instead. Create and Delete actions are not affected.
|
||||||
ForceReplace []addrs.AbsResourceInstance
|
ForceReplace []addrs.AbsResourceInstance
|
||||||
|
|
||||||
// Validate will do structural validation of the graph.
|
|
||||||
Validate bool
|
|
||||||
|
|
||||||
// skipRefresh indicates that we should skip refreshing managed resources
|
// skipRefresh indicates that we should skip refreshing managed resources
|
||||||
skipRefresh bool
|
skipRefresh bool
|
||||||
|
|
||||||
|
@ -73,7 +70,6 @@ type PlanGraphBuilder struct {
|
||||||
func (b *PlanGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics) {
|
func (b *PlanGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Diagnostics) {
|
||||||
return (&BasicGraphBuilder{
|
return (&BasicGraphBuilder{
|
||||||
Steps: b.Steps(),
|
Steps: b.Steps(),
|
||||||
Validate: b.Validate,
|
|
||||||
Name: "PlanGraphBuilder",
|
Name: "PlanGraphBuilder",
|
||||||
}).Build(path)
|
}).Build(path)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue