Vscode-terraform: Support pointing to path of terraform binary from settings.json

Created on 14 Aug 2020  路  5Comments  路  Source: hashicorp/vscode-terraform

I use the chtf tool to install and switch between different versions of Terraform. Because of this when I start up vscode the output from terraform-ls shows.

* unable to find terraform: exec: "terraform": executable file not found in $PATH
* no terraform executor - unable to read version
* unknown terraform version - unable to find parser
* unknown terraform version - unable to find state storage
* cannot update schema as schema cache is not available

Pycharm and other JetBrains editors allow you to set the path to a terraform binary for plugin functionality. Would it be possible to add the option to point to a binary in /vscode/settings.json?

documentation

Most helpful comment

I couldn't find any documentation on this in either repository but if you're using https://github.com/hashicorp/terraform-ls you can update terraform.languageServer.args to add the --tf-exec argument after the serve command:

Screen Shot 2020-08-21 at 5 11 21 PM

Since we can't update to 0.13 until we work around a removed feature I'm using this a fair amount.

All 5 comments

I couldn't find any documentation on this in either repository but if you're using https://github.com/hashicorp/terraform-ls you can update terraform.languageServer.args to add the --tf-exec argument after the serve command:

Screen Shot 2020-08-21 at 5 11 21 PM

Since we can't update to 0.13 until we work around a removed feature I'm using this a fair amount.

Thanks @acdha that's done the trick for me 馃憤 .

Might be worth leaving the issue open until there's documentation since this is currently opaque

I use tfenv to manage my terraform installations.
I need to figure out how to point through that instead.

update: Looks like tfenv puts this in the standard path of /usr/local/bin/terraform so I pointed to that and it worked. Thanks for this! I've not had a functional terraform linter in months.

Might be worth leaving the issue open until there's documentation since this is currently opaque

@acdha Reopened

Was this page helpful?
0 / 5 - 0 ratings