Fix: include_patterns ignored for terragrunt blocks without direct changes #2515
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #2485 where
include_patternswere only evaluated when at least one project had direct file changes in its root directory.Problem
The bug was in the
HandleYamlProjectGenerationfunction where the entire terragrunt block processing (including the merging ofinclude_patternsandexclude_patterns) was wrapped in acheckBlockInChangedFiles()conditional at line 422.This caused three different behaviors:
Case 1 (Working): Modifying files within a project → Project is planned ✅
Case 2 (Working): Modifying both project files AND files matching
include_patterns→ All projects are planned ✅Case 3 (Broken): Modifying only files matching
include_patterns→ No projects are planned ❌Solution
Removed the
checkBlockInChangedFiles()conditional wrapper that was preventing pattern evaluation. Now:include_patternsandexclude_patternsare always merged into projectsGetModifiedProjects()regardless of direct project changesChanges
libs/digger_config/digger_config.goTest plan
include_patternsfiles changeinclude_patternsfiles changeFixes #2485
🤖 Generated with Claude Code