mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-18 07:01:32 -04:00
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:
@@ -562,11 +562,13 @@ The -target option is not for routine use, and is provided only for exceptional
|
||||
p.Changes = c.changes
|
||||
|
||||
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
|
||||
// to Apply work as expected.
|
||||
c.state = c.refreshState
|
||||
c.state = refreshedState
|
||||
|
||||
return p, diags
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user