Terraform Extra
lang.terraform adds Terraform and HCL support through terraform-ls, with
terraform fmt formatting and tflint linting.
Enable it
-- ~/.config/blak/lua/blak/user.luareturn { extras = { enabled = { "lang.terraform", }, },}Or enable it interactively:
:BlakExtras enable lang.terraformWhat it adds
| Surface | Contribution |
|---|---|
| Treesitter | terraform, hcl |
| Mason | tflint |
| LSP | terraformls |
| Formatting | terraform_fmt for terraform, terraform-vars |
| Linting | tflint for terraform |
terraformls installs automatically through Mason (package terraform-ls).
terraform_fmt shells out to the terraform CLI, which must be on your
$PATH. terraform-ls does not serve generic .hcl files (Packer, Nomad), so
HCL receives Treesitter highlighting only.
Configure terraform-ls
return { extras = { enabled = { "lang.terraform" } }, lsp = { servers = { terraformls = { settings = { terraform = { validation = { enableEnhancedValidation = true }, }, }, }, }, },}Install and verify
:BlakToolsInstall:BlakTreesitterInstall:BlakDoctorOpen a .tf file and check :LspInfo for terraform-ls. Ensure the
terraform CLI is installed for format-on-save to work.