ares623 · 2022-09-21 10:10
I write a lot of Terraform at work, and currently rely on PyCharm for autocompletion and other features.
VSCode has LSP support using terraform-ls (the Hashicorp one), and it works decently, but I'm finding it hard to get used to VSCode's UX.
My assumption with LSP is that all heavy lifting should be done by the language server. Why does Eglot + terraform-ls not work as well as VSCode's implementation? Not even some basic auto-completion. Anyone managed to get it working?
brotzeitmacher · 2022-09-21 11:26
You could try lsp-mode for terraform, seems to work.
yyoncho · 2022-09-21 12:42
We have very active maintainer of terraform stuff in lsp-mode repo. You can always ping him in discord.
guitmz · 2022-09-21 22:28
It is working ok for me. With Corfu for autocomplete. I had to change some settings for the format on save to work but that was it I think
jleechpe · 2022-09-28 01:59
What version of `terraform-ls` are you using? There is currently a bug with 0.29.x on Linux/MacOS that is causing it to fail while using it in Emacs due to the symlinks Emacs creates when you edit a file.
ares623 · 2022-09-29 02:49
yeah I'm using 0.29.2
spolarian · 2022-10-19 17:26
I am also struggling getting autocomplete to work. Based on the lsp-mode documentation it seems like it should "just work" with company installed but I'm not seeing that. I installed [company-terraform](https://github.com/rafalcieslak/emacs-company-terraform) to get autocomplete for variables working.
With lsp-mode and terraform-ls I am getting some information about the structure of the file I'm working on and some errors sometimes.
fk00 · 2022-11-18 09:36
I was struggling to get it working, too. With my limited knowledge here I was not able to make it working stably. I had a very experience with eglot, though. It just worked out of the box with default setup taken from documentation. The completion worked fine, at least.