Function: terraform-mode

terraform-mode is an interactive and natively compiled function defined in terraform-mode.el.

Signature

(terraform-mode)

Documentation

Major mode for editing terraform configuration file

In addition to any hooks its parent mode hcl-mode might have run, this mode runs the hook terraform-mode-hook, as the final or penultimate step during initialization.

C-c C-d C-c terraform-kill-doc-url
C-c C-d C-r terraform-insert-doc-in-comment
C-c C-d C-w terraform-open-doc
C-c C-f outline-toggle-children

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/2sgzhgfr3sxpjh5dpyjjiqacrm3016bl-emacs-packages-deps/share/emacs/site-lisp/elpa/terraform-mode-20251115.2210/terraform-mode.el
;;;###autoload
(define-derived-mode terraform-mode hcl-mode "Terraform"
  "Major mode for editing terraform configuration file"

  (setq font-lock-defaults '((terraform-font-lock-keywords)))
  (when terraform-format-on-save
    (terraform-format-on-save-mode 1))

  ;; indentation
  (make-local-variable 'terraform-indent-level)
  (setq hcl-indent-level terraform-indent-level)

  ;; outline
  (terraform--setup-outline-mode)

  ;; imenu
  (set (make-local-variable 'imenu-sort-function) 'imenu--sort-by-name)
  (setq imenu-create-index-function 'terraform--generate-imenu)
  (imenu-add-to-menubar "Terraform"))