opentofu/internal/states/statemgr/lineage.go
Martin Atkins f40800b3a4 Move states/ to internal/states/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00

21 lines
586 B
Go

package statemgr
import (
"fmt"
uuid "github.com/hashicorp/go-uuid"
)
// NewLineage generates a new lineage identifier string. A lineage identifier
// is an opaque string that is intended to be unique in space and time, chosen
// when state is recorded at a location for the first time and then preserved
// afterwards to allow Terraform to recognize when one state snapshot is a
// predecessor or successor of another.
func NewLineage() string {
lineage, err := uuid.GenerateUUID()
if err != nil {
panic(fmt.Errorf("Failed to generate lineage: %v", err))
}
return lineage
}