2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: Terraform layer
|
2015-07-23 23:57:45 +00:00
|
|
|
|
2019-05-02 21:49:30 +00:00
|
|
|
#+TAGS: layer|tool
|
|
|
|
|
2015-07-23 23:57:45 +00:00
|
|
|
[[file:img/terraform.png]]
|
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2018-01-06 20:14:35 +00:00
|
|
|
- [[#features][Features:]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#install][Install]]
|
|
|
|
- [[#configuration][Configuration]]
|
|
|
|
- [[#auto-format-on-save][Auto-format on save]]
|
2020-06-20 07:00:02 +00:00
|
|
|
- [[#lsp][LSP]]
|
2015-07-23 23:57:45 +00:00
|
|
|
|
|
|
|
* Description
|
2018-01-06 20:14:35 +00:00
|
|
|
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=
|
2020-06-20 07:00:02 +00:00
|
|
|
- LSP support for terraform-lsp via =terraform-backend=
|
2015-07-23 23:57:45 +00:00
|
|
|
|
|
|
|
* Install
|
2016-01-06 05:21:55 +00:00
|
|
|
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.
|
2017-03-13 21:55:31 +00:00
|
|
|
|
2018-01-06 20:14:35 +00:00
|
|
|
You will also need a working native =terraform= installation on your system.
|
|
|
|
|
2017-03-13 21:55:31 +00:00
|
|
|
* Configuration
|
2017-04-12 04:04:38 +00:00
|
|
|
** 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=:
|
2017-03-13 21:55:31 +00:00
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
2017-04-12 04:04:38 +00:00
|
|
|
(terraform :variables terraform-auto-format-on-save t)
|
2018-09-19 03:54:47 +00:00
|
|
|
#+END_SRC
|
2020-06-20 07:00:02 +00:00
|
|
|
|
|
|
|
** LSP
|
|
|
|
To enable LSP, install [[https://github.com/juliosueiras/terraform-lsp][terraform-lsp]].
|
2020-06-22 18:57:05 +00:00
|
|
|
Then set the layer variable =terraform-backend= to ='lsp= like shown below:
|
2020-06-20 07:00:02 +00:00
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(terraform :variables terraform-backend 'lsp)
|
|
|
|
#+END_SRC
|
|
|
|
|
2020-06-22 18:57:05 +00:00
|
|
|
Alternatively you can also keep the variable on nil, then lsp will be used if lsp
|
|
|
|
layer is loaded.
|