Skip to content

fix: Skip terragrunt_validate for directories without terragrunt.hcl - #1006

Open
AruneshDwivedi wants to merge 1 commit into
antonbabenko:masterfrom
AruneshDwivedi:fix/terragrunt-validate-no-hcl
Open

fix: Skip terragrunt_validate for directories without terragrunt.hcl#1006
AruneshDwivedi wants to merge 1 commit into
antonbabenko:masterfrom
AruneshDwivedi:fix/terragrunt-validate-no-hcl

Conversation

@AruneshDwivedi

Copy link
Copy Markdown
Contributor

When terragrunt_validate runs against a directory containing only .hcl files but no terragrunt.hcl, it fails with a misleading error since terragrunt validate requires that file. This happened in multi-tier setups where base.hcl or tier.hcl files live alongside module directories. Added a check to skip directories without terragrunt.hcl.

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Terragrunt validation now runs only in directories containing a terragrunt.hcl file.
    • Directories without Terragrunt configuration are skipped, avoiding unnecessary validation errors.

Walkthrough

Changes

Terragrunt validation

Layer / File(s) Summary
Directory validation guard
hooks/terragrunt_validate.sh
per_dir_hook_unique_part skips directories without terragrunt.hcl and continues to run the configured Terragrunt validation command when the file exists.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: antonbabenko

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: skipping validation for directories without terragrunt.hcl.
Description check ✅ Passed The description directly explains the validation error and the change that skips directories without terragrunt.hcl.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AruneshDwivedi AruneshDwivedi changed the title fix: skip terragrunt_validate in dirs without terragrunt.hcl Fix: skip terragrunt_validate in dirs without terragrunt.hcl Aug 3, 2026
@AruneshDwivedi AruneshDwivedi changed the title Fix: skip terragrunt_validate in dirs without terragrunt.hcl Fix: Skip terragrunt_validate in dirs without terragrunt.hcl Aug 3, 2026
@AruneshDwivedi AruneshDwivedi changed the title Fix: Skip terragrunt_validate in dirs without terragrunt.hcl Fix: Skip terragrunt_validate for directories without terragrunt.hcl Aug 3, 2026
@AruneshDwivedi AruneshDwivedi changed the title Fix: Skip terragrunt_validate for directories without terragrunt.hcl fix: Skip terragrunt_validate for directories without terragrunt.hcl Aug 3, 2026
Comment thread hooks/terragrunt_validate.sh
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.

2 participants