05936df0e7
In the old state package we had this as a separate manager state.BackupState, but that doesn't work with our new interfaces because we handle lineage and serial within the state managers themselves and don't expose them to callers anymore. In practice it being built in to the filesystem manager is not a problem because we only use the backup functionality for local state anyway. This also slightly adjusts the behavior to be more intuitive. The old BackupState relied on the implementation detail that Terraform re-persists the original state early in an apply operation, which meant that by coincidence it would back up the right snapshot. In this new approach, we instead take an in-memory copy during State and then write _that_ to disk in WriteState if the new state seems different, so we're guaranteed that we'll always write out what we read before any changes were made. In future we may improve this further, such as keeping multiple generations of backups, etc. But for now this is intended to preserve the goals of the original implementation while making its behavior self-contained and not dependent on coincidences. |
||
---|---|---|
.. | ||
statefile | ||
statemgr | ||
doc.go | ||
eachmode_string.go | ||
import.go | ||
instance_generation.go | ||
instance_object.go | ||
module.go | ||
objectstatus_string.go | ||
output_value.go | ||
resource.go | ||
resource_test.go | ||
state.go | ||
state_deepcopy.go | ||
state_equal.go | ||
state_test.go | ||
sync.go |