Skip to content

Commit 5fdefe4

Browse files
committed
overide get_env function to avoid generation errors
1 parent 9e633fa commit 5fdefe4

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

libs/digger_config/terragrunt/tac/base_blocks.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ package tac
22

33
import (
44
"fmt"
5+
"log/slog"
6+
"strings"
7+
58
"github.com/gruntwork-io/go-commons/errors"
69
"github.com/gruntwork-io/terragrunt/config"
710
"github.com/gruntwork-io/terragrunt/options"
@@ -11,8 +14,6 @@ import (
1114
"github.com/hashicorp/hcl/v2/hclsyntax"
1215
"github.com/zclconf/go-cty/cty"
1316
"github.com/zclconf/go-cty/cty/gocty"
14-
"log/slog"
15-
"strings"
1617
)
1718

1819
const (
@@ -184,6 +185,7 @@ func attemptEvaluateLocals(
184185
}
185186

186187
evalCtx.Functions[config.FuncNameSopsDecryptFile] = wrapStringSliceToStringAsFuncImpl(NoopSopsDecryptFile, contextExtensions.TrackInclude, terragruntOptions)
188+
evalCtx.Functions[config.FuncNameGetEnv] = wrapStringSliceToStringAsFuncImpl(NoopGetEnv, contextExtensions.TrackInclude, terragruntOptions)
187189

188190
// Track the locals that were evaluated for logging purposes
189191
newlyEvaluatedLocalNames := []string{}

libs/digger_config/terragrunt/tac/context.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ func CreateTerragruntEvalContext(extensions config.EvalContextExtensions, filena
1515

1616
// override sops_decrypt_file function
1717
ctx.Functions[config.FuncNameSopsDecryptFile] = wrapStringSliceToStringAsFuncImpl(NoopSopsDecryptFile, extensions.TrackInclude, terragruntOptions)
18+
ctx.Functions[config.FuncNameSopsDecryptFile] = wrapStringSliceToStringAsFuncImpl(NoopGetEnv, extensions.TrackInclude, terragruntOptions)
19+
1820
return ctx, nil
1921
}

libs/digger_config/terragrunt/tac/sops_custom_fn.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ func NoopSopsDecryptFile(params []string, trackInclude *config.TrackInclude, ter
4545
terragruntOptions.Logger.Debugf("SOPS decryption function has been replaced with a no-op version. This is to ensure that generation of projects is successful.")
4646
return "{}", nil
4747
}
48+
49+
func NoopGetEnv(params []string, trackInclude *config.TrackInclude, terragruntOptions *options.TerragruntOptions) (string, error) {
50+
terragruntOptions.Logger.Debugf("get_env function has been replaced with a no-op version. This is to ensure that generation of projects is successful.")
51+
return "", nil
52+
}

0 commit comments

Comments
 (0)