I have recently started to use VSCode on my Mac, Linux and Windows machines (due to the demise of Atom), and just had the opportunity to start using the HashiCorp Terraform plugin. It seems to me that most things are working, but when editing a “.tf” file in an initialized Terraform project directory, the “Terraform Module Calls” panel gives me an error:
The active editor cannot provide information about installed modules. Learn more about modules You may need to run ‘terraform get’ or update your language server version.
From command line, all of my regular terraform
commands work fine, so I know the modules are initialized and current,
After reading through the Troubleshooting in the terraform-ls
GitHub, I didn’t really find any advice on what the problem might be, but I did find the instructions on the Manual Migration of the plugin config in settings.json
.
Also, it was unclear to me that the language server was actually installed somewhere, so I used brew install hashicorp/tap/terraform-ls
. and it now exists in /usr/local/bin/terraform-ls
, as does the Terraform executable itself. So I rewrite the Terraform config in settings.json
like this:
"terraform.codelens.referenceCount": true,
"terraform.languageServer.enable": true,
"terraform.languageServer.pathToBinary": "/usr/local/bin/terraform-ls",
"terraform.languageServer.args": ["serve"],
"terraform.languageServer.ignoreSingleFileWarning": false,
"terraform.languageServer.terraform.path": "/usr/local/bin/terraform",
"terraform.languageServer.terraform.timeout": "300",
Some of these are highlighted in a pale blue, like they aren’t recognized by the settings validation code, but I did not let that deter me.
When reloading, no errors are shown. The terraform-ls
process is running (according to ps
). But still, the error above is shown for Module Calls.
- macOS Big Sur 11.6.1
- Visual Studio Code 1.70.2
- HashiCorp Terraform (plugin) v2.23.0
- terraform-ls server (from Homebrew) v2.29.0
Thanks in advance,
Jeff