Skip to content

Commit

Permalink
action config update
Browse files Browse the repository at this point in the history
  • Loading branch information
denis256 committed Dec 20, 2024
1 parent a532787 commit ed16d24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions cli/commands/stack/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion config/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion config/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed16d24

Please sign in to comment.