Skip to content

Commit

Permalink
output dir corresponds to a resource group
Browse files Browse the repository at this point in the history
  • Loading branch information
koudaiii committed Oct 14, 2021
1 parent 03fcd83 commit cb216e9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/meta/meta_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,17 @@ func newMetaImpl(rg string, outputDir string) (Meta, error) {
return nil, fmt.Errorf("creating terraform cache dir %q: %w", tfDir, err)
}

wsp := filepath.Join(rootDir, rg)

if outputDir != "" {
currentWorkingDirectory, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("error finding the current working directory: %w", err)
}

rootDir = filepath.Join(currentWorkingDirectory, outputDir)
wsp = filepath.Join(currentWorkingDirectory, outputDir)
}

wsp := filepath.Join(rootDir, rg)
if err := os.RemoveAll(wsp); err != nil {
return nil, fmt.Errorf("removing existing workspace %q: %w", wsp, err)
}
Expand Down

0 comments on commit cb216e9

Please sign in to comment.