Skip to content

Commit b69ab3e

Browse files
committed
chore: Deprecating --units-that-include
1 parent eef197e commit b69ab3e

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

cli/commands/run/flags.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ func NewFlags(l log.Logger, opts *options.TerragruntOptions, prefix flags.Prefix
263263
EnvVars: tgPrefix.EnvVars(UnitsThatIncludeFlagName),
264264
Destination: &opts.ModulesThatInclude,
265265
Usage: "If flag is set, 'run --all' will only run the command against Terragrunt modules that include the specified file.",
266+
Hidden: true,
267+
Action: func(ctx *cli.Context, value []string) error {
268+
if len(value) != 0 {
269+
return opts.StrictControls.FilterByNames(controls.UnitsThatInclude).Evaluate(ctx.Context)
270+
}
271+
return nil
272+
},
266273
},
267274
flags.WithDeprecatedEnvVars(terragruntPrefix.EnvVars("modules-that-include"), terragruntPrefixControl)),
268275

internal/strict/controls/controls.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ const (
6262
// QueueStrictInclude is the control that prevents the use of the deprecated `--queue-strict-include` flag.
6363
QueueStrictInclude = "queue-strict-include"
6464

65+
// UnitsThatInclude is the control that prevents the use of the deprecated `--units-that-include` flag.
66+
UnitsThatInclude = "units-that-include"
67+
6568
// DiscoveryExternal is the control that prevents usage of the deprecated `--external` flag in discovery commands
6669
// like `find` and `list`.
6770
DiscoveryExternal = "discovery-external"
@@ -228,18 +231,25 @@ func New() strict.Controls {
228231
},
229232
&Control{
230233
Name: QueueExcludeExternal,
231-
Description: "Prevents the use of the deprecated `--queue-exclude-external` flag. External dependencies are now excluded by default.",
234+
Description: "Prevents the use of the deprecated `--queue-exclude-external` flag.",
232235
Category: stageCategory,
233236
Error: errors.New("The `--queue-exclude-external` flag is no longer supported. External dependencies are now excluded by default. Use --queue-include-external to include them."),
234237
Warning: "The `--queue-exclude-external` flag is deprecated and will be removed in a future version of Terragrunt. External dependencies are now excluded by default.",
235238
},
236239
&Control{
237240
Name: QueueStrictInclude,
238-
Description: "Prevents the use of the deprecated `--queue-strict-include` flag. Only modules under the directories passed in with '--queue-include-dir' will be included.",
241+
Description: "Prevents the use of the deprecated `--queue-strict-include` flag.",
239242
Category: stageCategory,
240243
Error: errors.New("The `--queue-strict-include` flag is no longer supported. The behavior of Terragrunt when using `--queue-strict-include` is now the default behavior."),
241244
Warning: "The `--queue-strict-include` flag is deprecated and will be removed in a future version of Terragrunt. The behavior of Terragrunt when using `--queue-strict-include` is now the default behavior.",
242245
},
246+
&Control{
247+
Name: UnitsThatInclude,
248+
Description: "Prevents the use of the deprecated `--units-that-include` flag.",
249+
Category: stageCategory,
250+
Error: errors.New("The `--units-that-include` flag is no longer supported. Use `--filter='reading=<path>'` to include units that include or read the specified configuration."),
251+
Warning: "The `--units-that-include` flag is deprecated and will be removed in a future version of Terragrunt. Use `--filter='reading=<path>'` to include units that include or read the specified configuration.",
252+
},
243253
&Control{
244254
Name: DiscoveryExternal,
245255
Description: "Prevents the use of the deprecated `--external` flag in discovery commands like `find` and `list`. External dependencies are now excluded by default.",

test/integration_include_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func TestTerragruntRunAllModulesThatIncludeRestrictsSet(t *testing.T) {
116116
stdout, _, err := helpers.RunTerragruntCommandWithOutput(
117117
t,
118118
fmt.Sprintf(
119-
"terragrunt run --all plan --non-interactive --log-level trace --tf-forward-stdout --working-dir %s --units-that-include alpha.hcl",
119+
"terragrunt run --all plan --non-interactive --log-level trace --tf-forward-stdout --working-dir %s --filter 'reading=alpha.hcl'",
120120
modulePath,
121121
),
122122
)

0 commit comments

Comments
 (0)