Skip to content

Commit

Permalink
Merge pull request #30059 from hashicorp/barrettclark/explicit-local-…
Browse files Browse the repository at this point in the history
…empty-migrate-messaging

Cloud: Do not ask to migrate empty default workspace
  • Loading branch information
chrisarcand committed Dec 1, 2021
2 parents 71a42f6 + c706c8f commit f4f5b7c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/command/meta_backend_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,21 @@ func (m *Meta) backendMigrateTFC(opts *backendMigrateOpts) error {
opts.sourceWorkspace = currentWorkspace

log.Printf("[INFO] backendMigrateTFC: single-to-single migration from source %s to destination %q", opts.sourceWorkspace, opts.destinationWorkspace)

// If the current workspace is has no state we do not need to ask
// if they want to migrate the state.
sourceState, err := opts.Source.StateMgr(currentWorkspace)
if err != nil {
return err
}
if err := sourceState.RefreshState(); err != nil {
return err
}
if sourceState.State().Empty() {
log.Printf("[INFO] backendMigrateTFC: skipping migration because source %s is empty", opts.sourceWorkspace)
return nil
}

// Run normal single-to-single state migration.
// This will handle both situations where the new cloud backend
// configuration is using a workspace.name strategy or workspace.tags
Expand Down

0 comments on commit f4f5b7c

Please sign in to comment.