copy the refreshed state at the end of plan
Otherwise we may end up with the same state value for the state and refreshState when re-using the context.
This commit is contained in:
parent
8dc6f518c2
commit
b464bcbc5d
|
@ -562,11 +562,13 @@ The -target option is not for routine use, and is provided only for exceptional
|
||||||
p.Changes = c.changes
|
p.Changes = c.changes
|
||||||
|
|
||||||
c.refreshState.SyncWrapper().RemovePlannedResourceInstanceObjects()
|
c.refreshState.SyncWrapper().RemovePlannedResourceInstanceObjects()
|
||||||
p.State = c.refreshState.DeepCopy()
|
|
||||||
|
refreshedState := c.refreshState.DeepCopy()
|
||||||
|
p.State = refreshedState
|
||||||
|
|
||||||
// replace the working state with the updated state, so that immediate calls
|
// replace the working state with the updated state, so that immediate calls
|
||||||
// to Apply work as expected.
|
// to Apply work as expected.
|
||||||
c.state = c.refreshState
|
c.state = refreshedState
|
||||||
|
|
||||||
return p, diags
|
return p, diags
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue