add SkipRefresh to the terraform context

This commit is contained in:
James Bardin 2020-09-23 11:04:27 -04:00
parent c2566bff7b
commit eebb4dfcb2
1 changed files with 17 additions and 13 deletions

View File

@ -47,13 +47,14 @@ var (
// ContextOpts are the user-configurable options to create a context with // ContextOpts are the user-configurable options to create a context with
// NewContext. // NewContext.
type ContextOpts struct { type ContextOpts struct {
Config *configs.Config Config *configs.Config
Changes *plans.Changes Changes *plans.Changes
State *states.State State *states.State
Targets []addrs.Targetable Targets []addrs.Targetable
Variables InputValues Variables InputValues
Meta *ContextMeta Meta *ContextMeta
Destroy bool Destroy bool
SkipRefresh bool
Hooks []Hook Hooks []Hook
Parallelism int Parallelism int
@ -97,6 +98,7 @@ type Context struct {
changes *plans.Changes changes *plans.Changes
state *states.State state *states.State
refreshState *states.State refreshState *states.State
skipRefresh bool
targets []addrs.Targetable targets []addrs.Targetable
variables InputValues variables InputValues
meta *ContextMeta meta *ContextMeta
@ -233,6 +235,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) {
config: config, config: config,
state: state, state: state,
refreshState: state.DeepCopy(), refreshState: state.DeepCopy(),
skipRefresh: opts.SkipRefresh,
targets: opts.Targets, targets: opts.Targets,
uiInput: opts.UIInput, uiInput: opts.UIInput,
variables: variables, variables: variables,
@ -293,12 +296,13 @@ func (c *Context) Graph(typ GraphType, opts *ContextGraphOpts) (*Graph, tfdiags.
case GraphTypePlan: case GraphTypePlan:
// Create the plan graph builder // Create the plan graph builder
return (&PlanGraphBuilder{ return (&PlanGraphBuilder{
Config: c.config, Config: c.config,
State: c.state, State: c.state,
Components: c.components, Components: c.components,
Schemas: c.schemas, Schemas: c.schemas,
Targets: c.targets, Targets: c.targets,
Validate: opts.Validate, Validate: opts.Validate,
skipRefresh: c.skipRefresh,
}).Build(addrs.RootModuleInstance) }).Build(addrs.RootModuleInstance)
case GraphTypePlanDestroy: case GraphTypePlanDestroy: