github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/states/statemgr/doc.go (about) 1 // Copyright (c) HashiCorp, Inc. 2 // SPDX-License-Identifier: MPL-2.0 3 4 // Package statemgr defines the interfaces and some supporting functionality 5 // for "state managers", which are components responsible for writing state 6 // to some persistent storage and then later retrieving it. 7 // 8 // State managers will usually (but not necessarily) use the state file formats 9 // implemented in the sibling directory "statefile" to serialize the persistent 10 // parts of state for storage. 11 // 12 // State managers are responsible for ensuring that stored state can be updated 13 // safely across multiple, possibly-concurrent Terraform runs (with reasonable 14 // constraints and limitations). The rest of Terraform considers state to be 15 // a mutable data structure, with state managers preserving that illusion 16 // by creating snapshots of the state and updating them over time. 17 // 18 // From the perspective of callers of the general state manager API, a state 19 // manager is able to return the latest snapshot and to replace that snapshot 20 // with a new one. Some state managers may also preserve historical snapshots 21 // using facilities offered by their storage backend, but this is always an 22 // implementation detail: the historical versions are not visible to a user 23 // of these interfaces. 24 package statemgr