mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-25 08:21:07 -06:00
cb2e9119aa
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
26 lines
729 B
Go
26 lines
729 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package statemgr
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"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 OpenTofu 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: %w", err))
|
|
}
|
|
return lineage
|
|
}
|