From 7f7371468c43b6290df520f151097eef0f99c4e4 Mon Sep 17 00:00:00 2001 From: Denis O Date: Fri, 21 Feb 2025 16:25:18 +0000 Subject: [PATCH] Config update --- config/config.go | 12 +++++++----- config/config_partial.go | 14 +++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/config/config.go b/config/config.go index 2c658713b..bbdc4b82d 100644 --- a/config/config.go +++ b/config/config.go @@ -895,12 +895,14 @@ func ParseConfig(ctx *ParsingContext, file *hclparse.File, includeFromChild *Inc } // read unit files and add to context - unitValues, err := ReadUnitValues(ctx.Context, ctx.TerragruntOptions, filepath.Dir(file.ConfigPath)) - if err != nil { - return nil, err - } + if ctx.TerragruntOptions.Experiments.Evaluate(experiment.Stacks) { + unitValues, err := ReadUnitValues(ctx.Context, ctx.TerragruntOptions, filepath.Dir(file.ConfigPath)) + if err != nil { + return nil, err + } - ctx = ctx.WithValues(unitValues) + ctx = ctx.WithValues(unitValues) + } // Decode just the Base blocks. See the function docs for DecodeBaseBlocks for more info on what base blocks are. baseBlocks, err := DecodeBaseBlocks(ctx, file, includeFromChild) diff --git a/config/config_partial.go b/config/config_partial.go index 0fef9d08c..a63d1440d 100644 --- a/config/config_partial.go +++ b/config/config_partial.go @@ -5,6 +5,8 @@ import ( "os" "path/filepath" + "github.com/gruntwork-io/terragrunt/internal/experiment" + "github.com/gruntwork-io/terragrunt/pkg/log" "github.com/huandu/go-clone" @@ -347,12 +349,14 @@ func PartialParseConfig(ctx *ParsingContext, file *hclparse.File, includeFromChi ctx = ctx.WithTrackInclude(nil) // read unit files and add to context - unitValues, err := ReadUnitValues(ctx.Context, ctx.TerragruntOptions, filepath.Dir(file.ConfigPath)) - if err != nil { - return nil, err - } + if ctx.TerragruntOptions.Experiments.Evaluate(experiment.Stacks) { + unitValues, err := ReadUnitValues(ctx.Context, ctx.TerragruntOptions, filepath.Dir(file.ConfigPath)) + if err != nil { + return nil, err + } - ctx = ctx.WithValues(unitValues) + ctx = ctx.WithValues(unitValues) + } // Decode just the Base blocks. See the function docs for DecodeBaseBlocks for more info on what base blocks are. // Initialize evaluation ctx extensions from base blocks.