A convenience package to take advantage of the Terraform Language Server.
- Install LSP, LSP-terraform and Terraform Syntax from Package Control.
- Restart Sublime Text.
- (Optional but recommended) Install the LSP-file-watcher-chokidar via Package Control to enable functionality to notify the server about new files.
Optionally install the Terraform CLI for the validateOnSave
and formatting functionality.
You may edit the default settings by running Preferences: LSP-terraform Settings
from the Command Palette.
Optionally you can view terraform-ls
settings at Hashicorps repo
The server supports formatting for the terraform files (equivalent to running terraform fmt
). You can either trigger it manually from the Command Palette using the LSP: Format File
command or automatically run it on saving the file. To enable formatting on save, open Preferences: LSP Settings
from the Command Palette and add or modify the following setting:
{
"lsp_code_actions_on_save": {
"source.formatAll.terraform": true,
},
}