patternterraformMinor
Terragrunt Linter
Viewed 0 times
linterterragruntstackoverflow
Problem
I'm having troubles using HCL files at VSCode. When I open the HCL file the indentations are messy. So I fix it and close the file, when I open again...messy again...
Someone know a add-ons to works with HCL files?
The official Terraform from Hachicorp not works, because I'm using Terragrunt Syntax.
I tried too the another called Hashicorp HCL, but the bugs continues...
Someone know a add-ons to works with HCL files?
The official Terraform from Hachicorp not works, because I'm using Terragrunt Syntax.
I tried too the another called Hashicorp HCL, but the bugs continues...
Solution
Until an add-on will be available, you can run this:
This will recursively search the current working directory for any folders that contain Terragrunt configuration files and run the equivalent of terraform fmt on them.
Or this, to format a sepcific file:
https://terragrunt.gruntwork.io/docs/getting-started/configuration/
Take it one step further:
https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave
Now every time you will save
Note - if you have auto save enabled, it will run automatically every time you make a change to
This will recursively search the current working directory for any folders that contain Terragrunt configuration files and run the equivalent of terraform fmt on them.
terragrunt hclfmtOr this, to format a sepcific file:
terragrunt hclfmt --terragrunt-hclfmt-file /path/to/hcl/filehttps://terragrunt.gruntwork.io/docs/getting-started/configuration/
Take it one step further:
- Install Run on Save -
https://marketplace.visualstudio.com/items?itemName=emeraldwalk.RunOnSave
- Add the follwoing config to settings.json
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.hcl$",
"cmd": "terragrunt hclfmt --terragrunt-hclfmt-file ${file}"
}
]
}
Now every time you will save
.hcl file, the terragrunt hclfmt command will run and reformat that file.Note - if you have auto save enabled, it will run automatically every time you make a change to
.hcl file.Code Snippets
terragrunt hclfmtterragrunt hclfmt --terragrunt-hclfmt-file /path/to/hcl/fileContext
StackExchange DevOps Q#13466, answer score: 4
Revisions (0)
No revisions yet.