question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension shouldn't check for problems in the .terraform folder

See original GitHub issue

Versions

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

  1. Create a new main.tf file
  2. Use a module like https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/tree/master/examples/safer_cluster_iap_bastion
  3. 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:open
  • Created a year ago
  • Reactions:5
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jpograncommented, Sep 6, 2022

As a temporary workaround, you could configure VS Code to purposely exclude the .terraform folder from being watched using files.watcherExclude:

"files.watcherExclude": {
    "**/.terraform/*/**": true,
  }

This of course prevents the Terraform Extension from knowing anything about those files (go to definition, intellisense, etc) , so use with caution.

1reaction
akeronecommented, Sep 12, 2022

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found