diff --git a/modules/tools/terraform/config.el b/modules/tools/terraform/config.el index 50db16809..24fcf66a7 100644 --- a/modules/tools/terraform/config.el +++ b/modules/tools/terraform/config.el @@ -3,14 +3,19 @@ (defvar +terraform-runner (if (executable-find "terragrunt") "terragrunt" "terraform") "The default runner - terraform or terragrunt") -(when (modulep! +lsp) - (add-hook 'terraform-mode-local-vars-hook #'lsp! 'append)) -(after! terraform-mode +;; +;;; Packages + +(use-package! terraform-mode + :defer t + :config (set-docsets! 'terraform-mode "Terraform") - (setq-hook! 'terraform-mode-hook compile-command +terraform-runner) + (when (modulep! +lsp) + (add-hook 'terraform-mode-local-vars-hook #'lsp! 'append)) + (map! :map terraform-mode-map :localleader :desc "apply" "a" (cmd! (compile (format "%s apply" +terraform-runner) t)) @@ -20,6 +25,7 @@ :desc "fmt" "f" (cmd! (compile (format "%s fmt" +terraform-runner))) :desc "destroy" "d" (cmd! (compile (format "%s destroy" +terraform-runner))))) + (use-package! company-terraform :when (modulep! :completion company) :after terraform-mode