Terraform layer
Table of ContentsClose
1. Description
This layer provides basic support for Terraform .tf files.
1.1. Features:
- Basic syntax highlighting via terraform-mode
- Auto formatting on save via
terraform fmt - LSP support for terraform-lsp via
terraform-backend
2. Install
To use this configuration layer, add it to your ~/.spacemacs. You will need to
add terraform to the existing dotspacemacs-configuration-layers list in this
file.
You will also need a working native terraform installation on your system.
3. Configuration
3.1. Auto-format on save
If you want terraform fmt to be applied automatically on save then set the
layer variable terraform-auto-format-on-save to t:
(terraform :variables terraform-auto-format-on-save t)
3.2. LSP
To enable LSP, install terraform-lsp.
Then set the layer variable terraform-backend to 'lsp like shown below:
(terraform :variables terraform-backend 'lsp)
Alternatively you can also keep the variable on nil, then lsp will be used if lsp layer is loaded.