Skip to content

Commit

Permalink
Don't merge state if import error in parallel import (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo authored Nov 9, 2022
1 parent 4bf3a53 commit e24f364
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/meta/base_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ func (meta *baseMeta) ParallelImport(items []*ImportItem) {

wp.Run(func(i interface{}) error {
idx := i.(int)

// Don't merge state if import error hit
if items[idx].ImportError != nil {
return nil
}

stateFile := filepath.Join(meta.importDirs[idx], "terraform.tfstate")

// Ensure the state file is removed after this round import, preparing for the next round.
Expand Down

0 comments on commit e24f364

Please sign in to comment.