Skip to content

Commit 4190cec

Browse files
committed
chore: npe fixes
1 parent 68bb2fd commit 4190cec

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

internal/discovery/unit_filtering.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ func (d *Discovery) flagUnitsThatRead(opts *options.TerragruntOptions, units com
212212

213213
// Fallback: check Config.ProcessedIncludes (include blocks from config)
214214
// This is needed because unit.Reading may not be populated in all cases
215-
for _, includeConfig := range unit.Config().ProcessedIncludes {
216-
if includeConfig.Path == normalizedPath {
217-
unit.SetFlagExcluded(false)
218-
break
215+
cfg := unit.Config()
216+
if cfg != nil {
217+
for _, includeConfig := range cfg.ProcessedIncludes {
218+
if includeConfig.Path == normalizedPath {
219+
unit.SetFlagExcluded(false)
220+
break
221+
}
219222
}
220223
}
221224
}
@@ -302,7 +305,12 @@ func (d *Discovery) telemetryApplyExcludeModules(l log.Logger, withUnitsThatAreI
302305
// applyExcludeModules sets FlagExcluded on units based on the exclude block in their terragrunt.hcl.
303306
func (d *Discovery) applyExcludeModules(l log.Logger, opts *options.TerragruntOptions, reportInstance *report.Report, units component.Units) component.Units {
304307
for _, unit := range units {
305-
excludeConfig := unit.Config().Exclude
308+
cfg := unit.Config()
309+
if cfg == nil {
310+
continue
311+
}
312+
313+
excludeConfig := cfg.Exclude
306314

307315
if excludeConfig == nil {
308316
continue

0 commit comments

Comments
 (0)