Skip to content

Commit aed80a0

Browse files
committed
chore: Expanding lll coverage to runall
1 parent d38c6eb commit aed80a0

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ linters:
121121
# trying to get this merged in.
122122
- linters:
123123
- lll
124-
path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|dag/graph|exec|find|help|list|scaffold|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/os/exec/|internal/prepare/|internal/queue/|internal/runner/(common|graph|run/creds|runcfg)/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tflint/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/(options|placeholders)|writer)/)'
124+
path-except: '^(internal/awshelper/|internal/cas/|internal/cli/commands/(backend/(delete|migrate)|catalog/tui/command|dag/graph|exec|find|help|list|scaffold|stack)/|internal/cloner/|internal/configbridge/|internal/engine/|internal/errorconfig/|internal/errors/|internal/experiment/|internal/gcphelper/|internal/git/|internal/os/exec/|internal/prepare/|internal/queue/|internal/runner/(common|graph|run/creds|runall|runcfg)/|internal/stacks/(generate|output)/|internal/tf/cache/(controllers|middleware)/|internal/tflint/|internal/tips/|internal/vfs/|internal/worktrees/|pkg/log/(format/(options|placeholders)|writer)/)'
125125
paths:
126126
- docs
127127
- _ci

internal/runner/runall/runall.go

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,18 @@ import (
2727
// Known terraform commands that are explicitly not supported in run --all due to the nature of the command. This is
2828
// tracked as a map that maps the terraform command to the reasoning behind disallowing the command in run --all.
2929
var runAllDisabledCommands = map[string]string{
30-
tf.CommandNameImport: "terraform import should only be run against a single state representation to avoid injecting the wrong object in the wrong state representation.",
31-
tf.CommandNameTaint: "terraform taint should only be run against a single state representation to avoid using the wrong state address.",
32-
tf.CommandNameUntaint: "terraform untaint should only be run against a single state representation to avoid using the wrong state address.",
33-
tf.CommandNameConsole: "terraform console requires stdin, which is shared across all instances of run --all when multiple modules run concurrently.",
34-
tf.CommandNameForceUnlock: "lock IDs are unique per state representation and thus should not be run with run --all.",
30+
tf.CommandNameImport: "terraform import should only be run against a single" +
31+
" state representation to avoid injecting the wrong object" +
32+
" in the wrong state representation.",
33+
tf.CommandNameTaint: "terraform taint should only be run against a single" +
34+
" state representation to avoid using the wrong state address.",
35+
tf.CommandNameUntaint: "terraform untaint should only be run against a single" +
36+
" state representation to avoid using the wrong state address.",
37+
tf.CommandNameConsole: "terraform console requires stdin, which is shared" +
38+
" across all instances of run --all when multiple modules" +
39+
" run concurrently.",
40+
tf.CommandNameForceUnlock: "lock IDs are unique per state representation" +
41+
" and thus should not be run with run --all.",
3542
}
3643

3744
func Run(ctx context.Context, l log.Logger, opts *options.TerragruntOptions) error {
@@ -90,7 +97,11 @@ func Run(ctx context.Context, l log.Logger, opts *options.TerragruntOptions) err
9097
err error
9198
)
9299
if len(gitFilters) > 0 {
93-
wts, err = worktrees.NewWorktrees(ctx, l, worktrees.WorktreeOpts{WorkingDir: opts.WorkingDir, GitExpressions: gitFilters, Experiments: opts.Experiments})
100+
wts, err = worktrees.NewWorktrees(ctx, l, worktrees.WorktreeOpts{
101+
WorkingDir: opts.WorkingDir,
102+
GitExpressions: gitFilters,
103+
Experiments: opts.Experiments,
104+
})
94105
if err != nil {
95106
return errors.Errorf("failed to create worktrees: %w", err)
96107
}
@@ -151,7 +162,13 @@ func Run(ctx context.Context, l log.Logger, opts *options.TerragruntOptions) err
151162
return RunAllOnStack(ctx, l, opts, rnr, r)
152163
}
153164

154-
func RunAllOnStack(ctx context.Context, l log.Logger, opts *options.TerragruntOptions, rnr common.StackRunner, r *report.Report) error {
165+
func RunAllOnStack(
166+
ctx context.Context,
167+
l log.Logger,
168+
opts *options.TerragruntOptions,
169+
rnr common.StackRunner,
170+
r *report.Report,
171+
) error {
155172
l.Debugf("%s", rnr.GetStack().String())
156173

157174
isDestroy := opts.TerraformCliArgs.IsDestroyCommand(opts.TerraformCommand)
@@ -165,9 +182,12 @@ func RunAllOnStack(ctx context.Context, l log.Logger, opts *options.TerragruntOp
165182
case tf.CommandNameApply:
166183
prompt = "Are you sure you want to run 'terragrunt apply' in each unit of the run queue displayed above?"
167184
case tf.CommandNameDestroy:
168-
prompt = "WARNING: Are you sure you want to run `terragrunt destroy` in each unit of the run queue displayed above? There is no undo!"
185+
prompt = "WARNING: Are you sure you want to run `terragrunt destroy`" +
186+
" in each unit of the run queue displayed above? There is no undo!"
169187
case tf.CommandNameState:
170-
prompt = "Are you sure you want to manipulate the state with `terragrunt state` in each unit of the run queue displayed above? Note that absolute paths are shared, while relative paths will be relative to each working directory."
188+
prompt = "Are you sure you want to manipulate the state with `terragrunt state`" +
189+
" in each unit of the run queue displayed above? Note that absolute paths are shared," +
190+
" while relative paths will be relative to each working directory."
171191
}
172192

173193
if prompt != "" {

0 commit comments

Comments
 (0)