Skip to content

Conversation

@breardon2011
Copy link
Contributor

Summary

This PR fixes issue #2485 where include_patterns were only evaluated when at least one project had direct file changes in its root directory.

Problem

The bug was in the HandleYamlProjectGeneration function where the entire terragrunt block processing (including the merging of include_patterns and exclude_patterns) was wrapped in a checkBlockInChangedFiles() 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:

  • Terragrunt projects are always generated for blocks
  • include_patterns and exclude_patterns are always merged into projects
  • Pattern matching occurs in GetModifiedProjects() regardless of direct project changes
  • Behavior is now consistent with non-terragrunt blocks

Changes

  • File modified: libs/digger_config/digger_config.go
  • Lines affected: 419-473
  • Removed conditional check that wrapped terragrunt block processing
  • Added clarifying comment explaining the fix

Test plan

  • Verify that projects are detected when only include_patterns files change
  • Verify that projects are still detected when direct project files change
  • Verify that projects are detected when both direct and include_patterns files change
  • Run existing tests to ensure no regressions

Fixes #2485

🤖 Generated with Claude Code

…nges

This commit fixes issue diggerhq#2485 where include_patterns were only evaluated
when at least one project had direct file changes in its root directory.

The bug was in the HandleYamlProjectGeneration function where the entire
terragrunt block processing was wrapped in a checkBlockInChangedFiles()
conditional. This prevented include_patterns from being merged into projects
when only files matching the include_patterns changed (but not files in the
project's root directory).

Changes:
- Removed the checkBlockInChangedFiles() conditional wrapper for terragrunt
  block processing
- Terragrunt projects are now always generated for blocks
- include_patterns and exclude_patterns are always merged, allowing pattern
  matching to occur in GetModifiedProjects() regardless of direct changes

This ensures consistent behavior between terragrunt and non-terragrunt blocks,
where include_patterns are evaluated independently of direct project changes.

Fixes diggerhq#2485

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@breardon2011
Copy link
Contributor Author

this is an AI project test please ignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

include_patterns ignored unless at least one project has direct changes

1 participant