How can I make VSCode auto complete work for Terraform on Mac?

Viewed 3673

I can't make auto complete work for .tf (and related) files with VSCode on my MacBook Pro.

Steps I took were:

  • Installed the HashiCorp Terraform plugin

  • Installed Terraform Language Server brew install terraform-ls

  • Got the path:

    : which terraform-ls /usr/local/bin/terraform-ls

  • And finally configured VSCode:

    "terraform.languageServer": { "external": true, "pathToBinary": "/usr/local/bin/terraform-ls", "args": [ "serve" ], "maxNumberOfProblems": 100, "trace.server": "off" }

I just get the auto completion for aws items which are already in this file:

enter image description here

What am I missing here? I wish those things were plug and play :(

3 Answers

If you still have this issue, Please try the solution which worked for me-

I had got the same problem in VS code when I installed the Terraform (Anton Kulikov) extension and the version was v0.2.2. I tried many things to make my autocomplete work ,but later when I found out the solution that if you degrade your version to v0.2.1 it works.

Hope this solution also works for you- Cheers

I worked out a workaround for this bug myself after experiencing it too. You might notice that aws_ and name are highlighted. If you hit Escape on your keyboard, it'll cancel the selection and then autosuggestions will begin working again. Not sure of the cause, but figured out this "fix" by accident.

Related