fix: replace deprecated hclfmt with hcl format command

Replace deprecated `terragrunt hclfmt` command with the recommended
`terragrunt hcl format` to eliminate deprecation warnings.

Resolves warning: "The `hclfmt` command is deprecated and will be
removed in a future version of Terragrunt."

Signed-off-by: widnyana <wid@widnyana.web.id>
This commit is contained in:
widnyana 2025-10-09 16:23:02 +07:00
commit f1a589bd12
No known key found for this signature in database
GPG key ID: D12BB2DBF87268AD

View file

@ -12,7 +12,7 @@ function main {
common::parse_cmdline "$@"
common::export_provided_env_vars "${ENV_VARS[@]}"
common::parse_and_export_env_vars
# JFYI: terragrunt hclfmt color already suppressed via PRE_COMMIT_COLOR=never
# JFYI: terragrunt hcl format color already suppressed via PRE_COMMIT_COLOR=never
# shellcheck disable=SC2153 # False positive
common::per_dir_hook "$HOOK_ID" "${#ARGS[@]}" "${ARGS[@]}" "${FILES[@]}"
@ -40,7 +40,7 @@ function per_dir_hook_unique_part {
local -a -r args=("$@")
# pass the arguments to hook
terragrunt hclfmt "${args[@]}"
terragrunt hcl format "${args[@]}"
# return exit code to common::per_dir_hook
local exit_code=$?
@ -57,7 +57,7 @@ function run_hook_on_whole_repo {
local -a -r args=("$@")
# pass the arguments to hook
terragrunt hclfmt "$(pwd)" "${args[@]}"
terragrunt hcl format "$(pwd)" "${args[@]}"
# return exit code to common::per_dir_hook
local exit_code=$?