source: https://www.reddit.com/r/Terraform/comments/e2fzn1/vs_code_terraform_extension_how_to_make_it_work/
S Code Terraform Extension - How To make it work for v0.12 So I've been fighting with VS Code to make the Terraform extension work for AWS for Terraform v0.12
After a couple of hours I think I have it working, so for anyone else that might have the same problem I thought I'd make this post.
My Setup: I'm using Windows 10 1903 build 18362.476 with VS Code 1.40.1 and the extension mauve.terraform 1.4.0
Here are the things you need to do:
Enable the Terraform Language Server in settings.json like so: "terraform.languageServer": { "enabled": true, "args": [] }
Disable the Terraform Indexing in settings.json like so: "terraform.indexing": { "enabled": false, "liveIndexing": false }
Make sure you have this line: provider "aws" {} in the providers.tf file here: C:\Users<your username>.vscode\extensions\mauve.terraform-1.4.0\lspbin\providers.tf
Make sure you have the AWS provider executable in these folders:
C:\Users<your username>.vscode\extensions\mauve.terraform-1.4.0\lspbin\
C:\Users<your username>.vscode\extensions\mauve.terraform-1.4.0\lspbin.terraform\plugins\windows_amd64 You can get the executable by running Terraform init by the way or by manually downloading it from here: https://releases.hashicorp.com/terraform-provider-aws/ I'm currently using this version: terraform-provider-aws_v2.38.0_x4.exe
If you're already running VS Code then reload it Go to the Command Palette (Ctrl+Shift+P) and type reload, then select reload window Then once vs code restarts, wait a bit for the language server to start.
Finally in a .tf file check if it works
For example type resource "aws_<ctrl+space> and you should see the auto-complete options.
Also inside a resources block like "aws_vpc" if you hit <ctrl+space> you should see the available options, like cidr_block.