Giter VIP home page Giter VIP logo

terraform-mode's Introduction

terraform-mode.el Tests melpa badge melpa stable badge

Major mode of Terraform configuration file

Screenshot

terraform-mode

imenu(helm-imenu)

terraform-mode

Installation

You can install terraform-mode.el from MELPA by package.el.

Features

  • Syntax highlighting
  • Indentation
  • imenu
  • Formatting using terraform fmt
  • Block folding
  • easier access to Terraform resource documentation

Block folding

terraform-mode sets up outline-mode variables for block folding. To use outline-mode for block folding, enable outline-minor-mode in terraform-mode-hook:

(add-hook 'terraform-mode-hook #'outline-minor-mode)

You can use outline-toggle-children bound to C-c C-f to toggle visibility of a block at point.

We also provide function terraform-toggle-or-indent which folds-or-indents. It is not bound by default, but you can bind it to TAB or any other key.

Access to Terraform resource documentation

Within a resource or a data block, type C-c C-d C-w to open a new browser tab with the resource or data documentation page.

Type C-c C-d C-c to kill the URL (i.e. copy it to the clipboard) for the documentation page rather than directly open it in the browser.

You can also type C-c C-d C-r to insert a comment containing a link to this documentation right above the resource or data block.

Customize Variables

terraform-indent-level(Default: 2)

Indentation size. You need to call revert-buffer if you change this value outer of hook such as eval-expression.

terraform-format-on-save(Default nil)

Set to t to automatically format the buffer on save.

Sample Configuration

(custom-set-variables
 '(terraform-indent-level 4))

With use-package

(use-package terraform-mode
  ;; if using straight
  ;; :straight t

  ;; if using package.el
  ;; :ensure t
  :custom (terraform-indent-level 4)
  :config
  (defun my-terraform-mode-init ()
    ;; if you want to use outline-minor-mode
    ;; (outline-minor-mode 1)
    )

  (add-hook 'terraform-mode-hook 'my-terraform-mode-init))

See Also

This major-mode inherits from hcl-mode. Most of syntax features, like highlighting, indentation are implemented in hcl-mode.

terraform-mode's People

Contributors

syohex avatar rnikoopour avatar fuco1 avatar dod38fr avatar phst avatar fbergroth avatar jplindstrom avatar jvshahid avatar kmosher avatar pd avatar mattiaslundberg avatar svend avatar itiut avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.