Add Terraform console functionality to Emacs.
This commit adds the ability to run a Terraform console at a specified path in a comint buffer, making it easier to interactively explore and manage Terraform state.
This commit is contained in:
parent
be07e673f9
commit
3537134c23
@ -61,6 +61,23 @@
|
|||||||
(let ((default-directory dir))
|
(let ((default-directory dir))
|
||||||
(apply oldfn args))))
|
(apply oldfn args))))
|
||||||
|
|
||||||
|
(defvar terraform-default-aws-profile "default"
|
||||||
|
"The default AWS profile to use when running terraform commands.")
|
||||||
|
|
||||||
|
(defun terraform-console (path)
|
||||||
|
"Run a Terraform console at `path' in a comint buffer."
|
||||||
|
(interactive (list (read-directory-name "Path: " (find-terraform-root))))
|
||||||
|
(let* ((process-environment (cons (format "AWS_PROFILE=%s" terraform-default-aws-profile)
|
||||||
|
process-environment))
|
||||||
|
(default-directory (expand-file-name path))
|
||||||
|
(program "terraform")
|
||||||
|
(switches (list "console"))
|
||||||
|
(expected-buf-name (apply #'make-comint program program nil switches)))
|
||||||
|
(comint-run "terraform" (list "console"))
|
||||||
|
(with-current-buffer expected-buf-name
|
||||||
|
(setq-local comint-prompt-read-only t
|
||||||
|
comint-process-echoes t))))
|
||||||
|
|
||||||
(advice-add 'terraform--get-resource-provider-namespace :around #'terraform-provider-ns-advice))
|
(advice-add 'terraform--get-resource-provider-namespace :around #'terraform-provider-ns-advice))
|
||||||
|
|
||||||
(defun terraform-jump-to-plan ()
|
(defun terraform-jump-to-plan ()
|
||||||
|
Loading…
Reference in New Issue
Block a user