terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

Ignore hidden folders when running terragrunt hclfmt or at least provide an option to ignore paths

Open yosefrow opened this issue 1 year ago • 1 comments

Describe the solution you'd like A clear and concise description of what you want to happen.

Ignore hidden folders when running terragrunt hclfmt or at least provide an option to ignore paths.

Use cases:

  1. Using .history folders which store many incomplete versions of terragrunt.hcl files that should not be evaluated
  2. Storing temporary backups of files in .bak folders
  3. Compatibility with any tool that needs to cache or backup terragrunt files in a hidden dir

Describe alternatives you've considered

  1. bash alias to find all .history folders in terragrunt dir and rm-rf them. This is a brutal workaround and one I prefer to avoid
  2. terragrunt hclfmt --terragrunt-exclude-dir '**/.history/*' --terragrunt-exclude-dir '**/.history/**/*' --terragrunt-check likely does not work because --terragrunt-exclude-dir only works with --run-all

Additional context being able to exclude paths for any terragrunt command including hclfmt seems like common sense to me. I feel I'm missing some obvious solution here. But I couldn't find it on my own.

yosefrow avatar Jan 17 '24 08:01 yosefrow

Also, if you have other *.hcl files in your repository (for example, for Vault), that are under a different formatting regime, it would be very useful to be able to exclude folders.

cmeury avatar Mar 11 '24 13:03 cmeury