Skip to content

Commit 7e98654

Browse files
committed
chore: fixes for failing tests
1 parent c988055 commit 7e98654

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

cli/commands/find/find.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func Run(ctx context.Context, l log.Logger, opts *Options) error {
2727
if err != nil {
2828
return errors.Errorf("failed to get absolute path for working directory %s: %w", opts.WorkingDir, err)
2929
}
30+
3031
opts.WorkingDir = util.CleanPath(absWorkingDir)
3132
// Also update the underlying TerragruntOptions
3233
opts.TerragruntOptions.WorkingDir = opts.WorkingDir

internal/runner/runnerpool/runner.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ func (r *Runner) Run(ctx context.Context, l log.Logger, opts *options.Terragrunt
279279
return err
280280
}
281281

282+
// Update the unit's execution options with the cloned options.
283+
// This ensures methods like GetOutputFile() and PlanFile() use the correct paths.
284+
u.SetTerragruntOptions(unitOpts)
285+
282286
return unitRunner.Run(childCtx, unitOpts, r.Stack.Report())
283287
})
284288
}

options/options.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,17 @@ func (opts *TerragruntOptions) CloneWithConfigPath(l log.Logger, configPath stri
535535
newOpts.TerragruntConfigPath = configPath
536536
newOpts.WorkingDir = workingDir
537537

538+
// Update DownloadDir if the original was using the default for its config path.
539+
// This ensures each unit uses its own .terragrunt-cache directory rather than
540+
// inheriting the parent's download directory.
541+
_, originalDefaultDownloadDir, err := DefaultWorkingAndDownloadDirs(opts.TerragruntConfigPath)
542+
if err == nil && opts.DownloadDir == originalDefaultDownloadDir {
543+
_, newDefaultDownloadDir, err := DefaultWorkingAndDownloadDirs(configPath)
544+
if err == nil {
545+
newOpts.DownloadDir = newDefaultDownloadDir
546+
}
547+
}
548+
538549
l = l.WithField(placeholders.WorkDirKeyName, workingDir)
539550

540551
return l, newOpts, nil

0 commit comments

Comments
 (0)