Skip to content

Conversation

@jrottenberg
Copy link
Contributor

@jrottenberg jrottenberg commented May 29, 2025

Put an x into the box if that apply:

  • This PR introduces breaking change.
  • This PR fixes a bug.
  • This PR adds new functionality.
  • This PR enhances existing functionality.

Description of your changes

hclfmt is being deprecated and terragrunt produces a warning on execution,
See https://github.com/gruntwork-io/terragrunt/releases/tag/v0.78.0

Fix :
WARN The `hclfmt` command is deprecated and will be removed in a future version of Terragrunt. Use `terragrunt hcl format` instead.

How can we test changes

With terragrunt v0.78 or above the pre-commit hook terragrunt_fmt should not emit any warnings.

Note: for version v0.77.22 and below hcl format is just ignored, no error but neither format for broken files.

`hclfmt` is being deprecated and terragrunt produces a warning on execution, See https://github.com/gruntwork-io/terragrunt/releases/tag/v0.78.0 Fix : ``` WARN The `hclfmt` command is deprecated and will be removed in a future version of Terragrunt. Use `terragrunt hcl format` instead. ```
@coderabbitai
Copy link

coderabbitai bot commented May 29, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Updated the formatting command for Terragrunt to ensure compatibility with the latest syntax. No changes to user-facing features or workflows.

Walkthrough

The script updates the Terragrunt formatting command within a function, switching from terragrunt hclfmt to the newer terragrunt hcl format syntax. This change affects the execution of the formatting tool but does not alter any other logic, argument handling, or control flow in the script.

Changes

File(s) Change Summary
hooks/terragrunt_fmt.sh Updated Terragrunt formatting command to hcl format.
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
hooks/terragrunt_fmt.sh (1)

65-68: 🛠️ Refactor suggestion

Align the root-hook command with the deprecation change
The run_hook_on_whole_repo block still uses the deprecated terragrunt hclfmt. For consistency and to avoid future warnings, update it to the new hcl format subcommand.

 function run_hook_on_whole_repo { local -a -r args=("$@") - terragrunt hclfmt "$(pwd)" "${args[@]}" + terragrunt hcl format "$(pwd)" "${args[@]}" # return exit code to common::per_dir_hook local exit_code=$? return $exit_code }
🧹 Nitpick comments (1)
hooks/terragrunt_fmt.sh (1)

15-15: Update comment to reflect new subcommand
The inline comment still references terragrunt hclfmt, but the script now invokes terragrunt hcl format. Updating this will avoid confusion.

- # JFYI: terragrunt hclfmt color already suppressed via PRE_COMMIT_COLOR=never + # JFYI: terragrunt hcl format color already suppressed via PRE_COMMIT_COLOR=never
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd939dd and f6e9256.

📒 Files selected for processing (1)
  • hooks/terragrunt_fmt.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: 🧪 Tests / pytest@🐍3.9@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.13@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.13@macos-13
  • GitHub Check: 🧪 Tests / pytest@🐍3.12@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.11@windows-2025
  • GitHub Check: 🧪 Tests / pytest@🐍3.10@macos-14
  • GitHub Check: 🧹 Linters / pre-commit@🐍3.13@ubuntu-latest
🔇 Additional comments (1)
hooks/terragrunt_fmt.sh (1)

49-49: Verify working-directory context or explicitly set it
You've switched to terragrunt hcl format "${args[@]}", which relies on the current directory being the target. If common::per_dir_hook cd's into dir_path, this is fine. Otherwise, you may need to pass --terragrunt-working-dir "$dir_path" to ensure the correct folder is formatted.

Would you please confirm how common::per_dir_hook manages the working directory? If it doesn’t cd, consider:

- terragrunt hcl format "${args[@]}" + terragrunt hcl format --terragrunt-working-dir "$dir_path" "${args[@]}"
@MaxymVlasov
Copy link
Collaborator

Hi. Thank you for your contribution, especially for details in description.

We actually get 2 similar PRs - your and #901
#901 currently is more complete, so I decided to use it as base one. I'll include you as coauthor to merge commit

@jrottenberg
Copy link
Contributor Author

Absolutely, I should have started with an issue.

Validated on 1.99.1 Thx a lot !

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

Labels

None yet

3 participants