Skip to content

Commit b1e36b6

Browse files
committed
move removal of external tflint flag back to tflint module
1 parent dde409e commit b1e36b6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/tflint/tflint.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"context"
77
"fmt"
88
"path/filepath"
9+
"slices"
910
"strings"
1011

1112
"github.com/gruntwork-io/terratest/modules/collections"
@@ -30,8 +31,13 @@ const (
3031

3132
// RunTflintWithOpts runs tflint with the given options and returns an error if there are any issues.
3233
func RunTflintWithOpts(ctx context.Context, l log.Logger, opts *options.TerragruntOptions, cfg *runcfg.RunConfig, hook *runcfg.Hook, externalTfLint bool) error {
34+
hookExecute := slices.Clone(hook.Execute)
35+
hookExecute = slices.DeleteFunc(hookExecute, func(arg string) bool {
36+
return arg == TfExternalTFLint
37+
})
38+
3339
// try to fetch configuration file from hook parameters
34-
configFile, err := tflintConfigFilePath(l, opts, hook.Execute)
40+
configFile, err := tflintConfigFilePath(l, opts, hookExecute)
3541
if err != nil {
3642
return err
3743
}
@@ -55,7 +61,7 @@ func RunTflintWithOpts(ctx context.Context, l log.Logger, opts *options.Terragru
5561
return errors.New(err)
5662
}
5763

58-
tflintArgs := hook.Execute[1:]
64+
tflintArgs := hookExecute[1:]
5965

6066
// tflint init
6167
initArgs := []string{"tflint", "--init", "--config", configFile, "--chdir", opts.WorkingDir}

0 commit comments

Comments
 (0)