Skip to content

Commit

Permalink
Merge pull request hashicorp#17312 from hashicorp/b-state-uuid
Browse files Browse the repository at this point in the history
terraform: use hashicorp/go-uuid for lineage generation
  • Loading branch information
ryanuber authored Feb 9, 2018
2 parents 58840f6 + 71ac503 commit a25d98b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions terraform/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a25d98b

Please sign in to comment.