Extension shouldn't check for problems in the .terraform folder
See original GitHub issueVersions
Extension
v2.24.1
VS Code
Version: 1.71.0 (user setup)
Commit: 784b0177c56c607789f9638da7b6bf3230d47a8c
Date: 2022-09-01T07:36:10.600Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.19043
Sandboxed: No
Operating System
Windows
Edition Windows 10 Enterprise
Version 21H1
Installed on 27/08/2021
OS build 19043.1415
Experience Windows Feature Experience Pack 120.2212.3920.0
WSL
Ubuntu 20.04.4 LTS
Terraform Version
Terraform v1.2.7
Steps To Reproduce
- Create a new main.tf file
- Use a module like https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/examples/safer_cluster_iap_bastion
- terraform init
Expected Behavior
No errors on the “Problems” tab of vscode
Actual Behavior
The extension checks for errors in the .terraform folder, giving an error for file in the “autogen” folder. Looking at the file, it’s templated with Jinja so it gives “Argument or block definition required: An argument or block definition is required here.” before double curly braces.
My code is correct and the module itself works, so seeing the red ball next to the project and folders because of something in the .terraform folder is really annoying.
Additional context
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:12 (4 by maintainers)
Top Results From Across the Web
No root module found? - Terraform - HashiCorp Discuss
The Terraform extension is v2.0.2. When I open a terraform module, I get this message… No root module found for main.tf functionality may...
Read more >terraform-google-modules/iam/google | folder Example
Submodules without a README or README.md are considered to be internal-only by the Terraform Registry. If this submodule should not be considered internal,...
Read more >Best practices for using Terraform | Google Cloud
Use variables carefully. Expose outputs. Use data sources. Limit the use of custom scripts. Include helper scripts in a separate directory. Put static...
Read more >Terraform Best Practices: The 20 Practices You Should Adopt
AWS access key and secret key, for example, should not be stored in plain text format in Terraform configuration files since Terraform stores...
Read more >How to manage Terraform state - Gruntwork Blog
Put the Terraform configuration files for each environment into a separate folder. For example, all of the configurations for the staging environment can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

As a temporary workaround, you could configure VS Code to purposely exclude the
.terraformfolder from being watched usingfiles.watcherExclude:This of course prevents the Terraform Extension from knowing anything about those files (go to definition, intellisense, etc) , so use with caution.
Thanks @jpogran !
That would be an acceptable workaround, although it doesn’t seem to work in my machine. I’ve tried adding it to User, Remote and Workspace and both as
**/.terraform/**and**/.terraform/*/**and neither seems to remove the errors. I’ve also restarted VS Code after each change.Any other ideas?