Manual install for terraform-ls in vscode remote ssh editor

I’m using the vscode ssh remote editor extension to work on virtual machines without internet access. The terraform-vscode plugin can handle installing itself in this scenario but the language server fails to install. I have opened a bug for that here https://github.com/hashicorp/vscode-terraform/issues/451

Does anybody know the steps needed to manually install and update the language server in this situation? I have downloaded the latest binary of the language server and put it at ~/.vscode-server/extensions/hashicorp.terraform-2.2.2/lsp/terraform-ls on the remote system. Running the enable language server command fails when it tries to download from the internet. I have confirmed the vscode settings are set to default. When I attempt to format code in my vscode remote session it just pops up the install formatter dialog.

Please Advise,
Blake

I did figure out how to configure this manually as a workaround.

 "terraform.languageServer": {
    "external": true,
    "pathToBinary": "/home/totallyme/.vscode-server/extensions/hashicorp.terraform-2.2.3/lsp/terraform-ls",
    "args": [
        "serve"
    ]
},

Thanks @trodemaster. I assume this snippet just go into either a User or Workspace settings.json file? Where did you find this info - is this documented at the terraform-ls project or did you have to grep the code?

vscode now has user and workspace settings. I have been adding the path to the workspace settings on the non-internet connected hosts now.

Hi folks,
I just wanted to note that we plan to look into bundling of the LS binary with the extension which would avoid the need for workarounds mentioned here.

This effort is tracked under Bundle language server with extension release · Issue #820 · hashicorp/vscode-terraform · GitHub

Feel free to subscribe to that issue, upvote it or comment there if you have anything relevant to say regarding that idea.

1 Like