Skip to content

Instantly share code, notes, and snippets.

@caseycs
Created June 1, 2024 13:01
Show Gist options
  • Save caseycs/8a1d528b7072d9d7e20bde54b01b27a8 to your computer and use it in GitHub Desktop.
Save caseycs/8a1d528b7072d9d7e20bde54b01b27a8 to your computer and use it in GitHub Desktop.
#!/bin/sh
# wrapper to format hcl passed via stdin
# user for for VSCcode Custom Local Formatters extension (https://marketplace.visualstudio.com/items?itemName=jkillian.custom-local-formatters)
# or any other editor relying on stdin/stdout for formatting, like Zed
# relevant issues:
# * https://github.com/gruntwork-io/terragrunt/issues/1037
# * https://github.com/gruntwork-io/terragrunt/issues/2926
TMPFILE=$(mktemp)
cat - > $TMPFILE
terragrunt hclfmt --terragrunt-hclfmt-file $TMPFILE
cat $TMPFILE
rm $TMPFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment