Menu

1 / 2

hcl-linter 0.0.1-alpha is out

DEV Community·Bartłomiej Danek·6 months ago
#G8dZKgqM
#terraform#hcl#terragrunt#devops#enter
Reading 0:00
15s threshold

hcl-linter 0.0.1-alpha is out

terraform fmt only touches whitespace. In a codebase with dozens of contributors and hundreds of HCL files, block order drifts, naming conventions split, and required fields go missing quietly. I wanted something that could catch and fix that automatically - so I built hcl-linter .

The first run fixed over 1000 terragrunt.hcl files.

getting started

Two commands to go from nothing to a first pass:

hcl-linter init # scaffold .hcl-linter/ from your existing files hcl-linter fix ./ --dry-run # preview what would change

Enter fullscreen mode

Exit fullscreen mode

init walks the project, groups files by basename, and writes a .hcl-linter/default.hcl plus one extends = "default" override per unique filename. No config needed for a first formatting pass either - --format applies opinionated defaults without any config:

hcl-linter fix ./ --format --dry-run

Enter fullscreen mode

Exit fullscreen mode

block order

Wrong block order is the most common drift.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.