insert PlanRefresh into the context
This commit is contained in:
parent
b16c600edc
commit
37569f5cc3
|
@ -78,6 +78,11 @@ func (b *Local) context(op *backend.Operation) (*terraform.Context, *configload.
|
||||||
opts.Targets = op.Targets
|
opts.Targets = op.Targets
|
||||||
opts.UIInput = op.UIIn
|
opts.UIInput = op.UIIn
|
||||||
|
|
||||||
|
opts.SkipRefresh = op.Type == backend.OperationTypePlan && !op.PlanRefresh
|
||||||
|
if opts.SkipRefresh {
|
||||||
|
log.Printf("[DEBUG] backend/local: skipping refresh of managed resources")
|
||||||
|
}
|
||||||
|
|
||||||
// Load the latest state. If we enter contextFromPlanFile below then the
|
// Load the latest state. If we enter contextFromPlanFile below then the
|
||||||
// state snapshot in the plan file must match this, or else it'll return
|
// state snapshot in the plan file must match this, or else it'll return
|
||||||
// error diagnostics.
|
// error diagnostics.
|
||||||
|
|
|
@ -678,6 +678,7 @@ func TestLocal_planOutPathNoChange(t *testing.T) {
|
||||||
Type: "local",
|
Type: "local",
|
||||||
Config: cfgRaw,
|
Config: cfgRaw,
|
||||||
}
|
}
|
||||||
|
op.PlanRefresh = true
|
||||||
|
|
||||||
run, err := b.Operation(context.Background(), op)
|
run, err := b.Operation(context.Background(), op)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -42,6 +42,9 @@ func (b *Local) opRefresh(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refresh now happens via a plan, so we need to ensure this is enabled
|
||||||
|
op.PlanRefresh = true
|
||||||
|
|
||||||
// Get our context
|
// Get our context
|
||||||
tfCtx, _, opState, contextDiags := b.context(op)
|
tfCtx, _, opState, contextDiags := b.context(op)
|
||||||
diags = diags.Append(contextDiags)
|
diags = diags.Append(contextDiags)
|
||||||
|
|
Loading…
Reference in New Issue