Merge pull request #17312 from hashicorp/b-state-uuid

terraform: use hashicorp/go-uuid for lineage generation
This commit is contained in:
Ryan Uber 2018-02-09 15:21:10 -08:00 committed by GitHub
commit a25d98b6d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -16,10 +16,10 @@ import (
"sync"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform/config"
"github.com/mitchellh/copystructure"
"github.com/satori/go.uuid"
tfversion "github.com/hashicorp/terraform/version"
)
@ -706,7 +706,11 @@ func (s *State) EnsureHasLineage() {
func (s *State) ensureHasLineage() {
if s.Lineage == "" {
s.Lineage = uuid.NewV4().String()
lineage, err := uuid.GenerateUUID()
if err != nil {
panic(fmt.Errorf("Failed to generate lineage: %v", err))
}
s.Lineage = lineage
log.Printf("[DEBUG] New state was assigned lineage %q\n", s.Lineage)
} else {
log.Printf("[TRACE] Preserving existing state lineage %q\n", s.Lineage)