This commit is contained in:
ry
2022-01-11 18:05:13 -08:00
parent 2046befee2
commit 8e7b654716
846 changed files with 71287 additions and 4 deletions

View File

@@ -0,0 +1,69 @@
#+TITLE: tools/terraform
#+DATE: November 21, 2019
#+SINCE: v2.1.0
#+STARTUP: inlineimages
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#syntax-highlighting][Syntax highlighting]]
- [[#code-formatting][Code formatting]]
- [[#code-navigation][Code navigation]]
- [[#code-completion][Code completion]]
- [[#documentation][Documentation]]
- [[#executing-terraform-commands][Executing Terraform commands]]
- [[#appendix][Appendix]]
- [[#keybindings][Keybindings]]
- [[#localleader][:localleader]]
* Description
This module adds support for working with [[https://www.terraform.io][Terraform]] files in Doom Emacs. This
includes syntax highlighting, intelligent code completion, and the ability to run
Terraform commands directly from Emacs.
** Module Flags
This module provides no flags.
** Plugins
+ [[https://github.com/syohex/emacs-terraform-mode][terraform-mode]]
+ [[https://github.com/rafalcieslak/emacs-company-terraform][company-terraform*]]
* Prerequisites
The =terraform= executable must be installed and accessible from your PATH.
* Features
** Syntax highlighting
Syntax highlighting is provided from =terraform-mode= and =hcl-mode=.
** Code formatting
=:tools terraform= does not provide code formatting directly, but =:editor
format= works with Terraform files.
** Code navigation
Code navigation is supported through =imenu= from =terraform-mode=.
** Code completion
Code completion of Terraform builtins is provided from =company-terraform= and
generally works well despite being generated through a [[https://github.com/rafalcieslak/emacs-company-terraform/blob/master/company-terraform-data.el][static (outdated) file]].
=company-terraform= also provides code completion of resources within your project.
** Documentation
Documentation is accessible through the normal =company-mode= show documentation
functionality, thanks to =company-terraform=.
** Executing Terraform commands
=:tools terraform= provides commands under the =localleader= to run the most
common Terraform operations (see Keybindings below).
* Appendix
** Keybindings
*** :localleader
| key | description |
|-----+-----------------------|
| =i= | Run =terraform init= |
| =p= | Run =terraform plan= |
| =a= | Run =terraform apply= |

View File

@@ -0,0 +1,21 @@
;;; tools/terraform/config.el -*- lexical-binding: t; -*-
(when (featurep! +lsp)
(add-hook 'terraform-mode-local-vars-hook #'lsp!))
(after! terraform-mode
(set-docsets! 'terraform-mode "Terraform")
(map! :map terraform-mode-map
:localleader
:desc "terraform apply" "a" (cmd! (compile "terraform apply" t))
:desc "terraform init" "i" (cmd! (compile "terraform init"))
:desc "terraform plan" "p" (cmd! (compile "terraform plan"))))
(use-package! company-terraform
:when (featurep! :completion company)
:after terraform-mode
:config
(set-company-backend! 'terraform-mode 'company-terraform))

View File

@@ -0,0 +1,4 @@
;;; tools/terraform/doctor.el -*- lexical-binding: t; -*-
(unless (executable-find "terraform")
(warn! "Couldn't find terraform."))

View File

@@ -0,0 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; tools/terraform/packages.el
(package! terraform-mode :pin "e560caaa9d9a11b0868adf6d9dcae5ebb5055730")
(when (featurep! :completion company)
(package! company-terraform :pin "2d11a21fee2f298e48968e479ddcaeda4d736e12"))