try refreshing during plan as the default

This breaks a bunch of tests, and we need to figure out why before
moving on.
This commit is contained in:
James Bardin 2020-09-04 18:09:47 -04:00
parent 5cf7e237d5
commit 908217acc4
1 changed files with 7 additions and 21 deletions

View File

@ -541,31 +541,13 @@ The -target option is not for routine use, and is provided only for exceptional
ProviderSHA256s: c.providerSHA256s,
}
var operation walkOperation
if c.destroy {
operation = walkPlanDestroy
} else {
// Set our state to be something temporary. We do this so that
// the plan can update a fake state so that variables work, then
// we replace it back with our old state.
old := c.state
if old == nil {
c.state = states.NewState()
} else {
c.state = old.DeepCopy()
}
defer func() {
c.state = old
}()
operation = walkPlan
}
// Build the graph.
operation := walkPlan
graphType := GraphTypePlan
if c.destroy {
operation = walkPlanDestroy
graphType = GraphTypePlanDestroy
}
graph, graphDiags := c.Graph(graphType, nil)
diags = diags.Append(graphDiags)
if graphDiags.HasErrors() {
@ -583,6 +565,10 @@ The -target option is not for routine use, and is provided only for exceptional
p.State = c.refreshState
// replace the working state with the updated state, so that immediate calls
// to Apply work as expected.
c.state = c.refreshState
return p, diags
}