opentofu/states
Martin Atkins 05936df0e7 statemgr: Backup file support for statemgr.Filesystem
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.
2018-10-16 18:50:57 -07:00
..
statefile statefile: New package for loading and saving state files 2018-10-16 18:49:20 -07:00
statemgr statemgr: Backup file support for statemgr.Filesystem 2018-10-16 18:50:57 -07:00
doc.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
eachmode_string.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
import.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
instance_generation.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
instance_object.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
module.go states: New SyncState type 2018-10-16 18:49:20 -07:00
objectstatus_string.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
output_value.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
resource_test.go states: New SyncState type 2018-10-16 18:49:20 -07:00
resource.go states: New SyncState type 2018-10-16 18:49:20 -07:00
state_deepcopy.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
state_equal.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
state_test.go states: New package with modern models for Terraform state 2018-10-16 18:49:20 -07:00
state.go various: helpers for collecting necessary provider types 2018-10-16 18:50:29 -07:00
sync.go states: New SyncState type 2018-10-16 18:49:20 -07:00