Set up Terraform in VSCode to Automatically Recognize .TF files
Hashicorp | Visual Studio Code | Settings | Extensions | DevOps
So there are times that after installing the extension that .tf files are not automatically recognized in Visual Studio Code. For this reason, I am going to write a quick article on how to do this with ease. This article does assume that you have already installed the Extention called “Hashicorp Terraform”.
Step 1. Create a .vscode directory
Now if you have made any setting changes in VSCode then you probably already have a directory called .vscode. When in that directory there should be a settings.json file. Of course, if there is not a settings.json file then create the file.
Step 2. Setup settings.json file to read .tf files
Add the following to the settings.json file.
{
"files.associations": {
"terragrunt.hcl": "terraform",
"*.tfvars": "terraform",
"*.tf": "terraform",
"*.tf.override": "terraform",
}
}The main thing to add is in the file. associations the extension types and which type of plugin will be associated with it.
Save the file after modifying it. That's It! You should now be able to see that the .tf files are automatically updated.
This was a quick article and if you like more of these then please subscribe. Thanks!






