From ed16d24cc3148a4d774f7a173a927467919fad73 Mon Sep 17 00:00:00 2001 From: Denis O Date: Fri, 20 Dec 2024 18:18:49 +0000 Subject: [PATCH] action config update --- cli/commands/stack/action.go | 9 +++++---- config/stack.go | 2 +- config/unit.go | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cli/commands/stack/action.go b/cli/commands/stack/action.go index 52d3300816..7db64e2784 100644 --- a/cli/commands/stack/action.go +++ b/cli/commands/stack/action.go @@ -41,19 +41,20 @@ func generateStack(ctx context.Context, opts *options.TerragruntOptions) error { return err } - if err := processStackFile(ctx, stackFile); err != nil { + if err := processStackFile(ctx, opts, stackFile); err != nil { return err } return nil } -func processStackFile(ctx context.Context, stackFile *config.StackConfigFile) error { - if err := os.MkdirAll(stackCacheDir, 0755); err != nil { +func processStackFile(ctx context.Context, opts *options.TerragruntOptions, stackFile *config.StackConfigFile) error { + baseDir := filepath.Join(opts.WorkingDir, stackCacheDir) + if err := os.MkdirAll(baseDir, 0755); err != nil { return errors.New(fmt.Errorf("failed to create base directory: %w", err)) } for _, unit := range stackFile.Units { - destPath := filepath.Join(stackCacheDir, unit.Path) + destPath := filepath.Join(baseDir, unit.Path) if err := os.MkdirAll(destPath, 0755); err != nil { return errors.New(fmt.Errorf("failed to create destination directory '%s': %w", destPath, err)) diff --git a/config/stack.go b/config/stack.go index f002429c3c..1a2e947936 100644 --- a/config/stack.go +++ b/config/stack.go @@ -27,7 +27,7 @@ func ReadStackConfigFile(ctx context.Context, terragruntOptions *options.Terragr evalParsingContext, err := createTerragruntEvalContext(parseCtx, file.ConfigPath) config := &StackConfigFile{} - if err := file.Decode(&config, evalParsingContext); err != nil { + if err := file.Decode(config, evalParsingContext); err != nil { return nil, err } diff --git a/config/unit.go b/config/unit.go index eccf98be09..4b555f5169 100644 --- a/config/unit.go +++ b/config/unit.go @@ -11,7 +11,7 @@ import ( type Unit struct { Name string `cty:"name" hcl:",label"` Source string `hcl:"source,attr" cty:"source"` - Path string `hcl:"source,attr" cty:"source"` + Path string `hcl:"path,attr" cty:"path"` } // ToCtyValue converts StackConfigFile to cty.Value