With my Jet Brains renewal coming up next month, I decided to give VS Code an honest evaluation. I have been writing a lot of Terraform lately so that was one of the first extensions that I installed. As I started going through my various terraform related projects, I came across an interesting issue. When I opened up my repository that had my Vault configuration in it, I started getting “provider does not exist” and “resource does not exist” errors. After a little bit of searching, I was able to find a solution to this issue.

Adding the Vault Provider

To add the Vault provider, you need to download the latest version of the Vault provider from https://releases.hashicorp.com/ and add it to $HOME/.vscode/extensions/mauve.terraform-1.4.0/lspbin/ directory. Then update the providers.tf file in the same directory and add vault as a provider.

cd $HOME/.vscode/extensions/mauve.terraform-1.4.0/lspbin
wget https://releases.hashicorp.com/terraform-provider-vault/2.7.0/terraform-provider-vault_2.7.0_darwin_amd64.zip
unzip terraform-provider-vault_2.7.0_darwin_amd64.zip
echo 'provider "vault" {}' >> $HOME/.vscode/extensions/mauve.terraform-1.4.0/lspbin/providers.tf

Adding Other Providers

When I installed the extension, it came with the following providers:

provider "aws" {}
provider "azurerm" {}
provider "google" {}
provider "alicloud" {}
provider "helm" {}
provider "kubernetes" {}
provider "random" {}
provider "null" {}
provider "external" {}
provider "template" {}
provider "archive" {}

You can use the same procedure that I outlined for Vault to install any of the additional providers, such as the GitHub provider.

I’m still not sure about VS Code, but at least I can work on my Vault terraform.