This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+tools/terraform/README.org
Maximilian Wolff 5dcf7ae8e6
[terraform] Revise terraform lsp support
Made lsp support for terraform follow the convention
that if not explicitly set the backend shall be
inferred from the loaded layers in the dotfile.
2020-06-22 21:27:12 +02:00

48 lines
1.5 KiB
Org Mode

#+TITLE: Terraform layer
#+TAGS: layer|tool
[[file:img/terraform.png]]
* Table of Contents :TOC_5_gh:noexport:
- [[#description][Description]]
- [[#features][Features:]]
- [[#install][Install]]
- [[#configuration][Configuration]]
- [[#auto-format-on-save][Auto-format on save]]
- [[#lsp][LSP]]
* Description
This layer provides basic support for Terraform =.tf= files.
** Features:
- Basic syntax highlighting via [[https://github.com/syohex/emacs-terraform-mode][terraform-mode]]
- Auto formatting on save via =terraform fmt=
- LSP support for terraform-lsp via =terraform-backend=
* 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.
* Configuration
** 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=:
#+BEGIN_SRC emacs-lisp
(terraform :variables terraform-auto-format-on-save t)
#+END_SRC
** LSP
To enable LSP, install [[https://github.com/juliosueiras/terraform-lsp][terraform-lsp]].
Then set the layer variable =terraform-backend= to ='lsp= like shown below:
#+BEGIN_SRC emacs-lisp
(terraform :variables terraform-backend 'lsp)
#+END_SRC
Alternatively you can also keep the variable on nil, then lsp will be used if lsp
layer is loaded.