I use several vscode workspaces. Only one of them has any terraform files.
Having this extension tell me to run terraform init in every non-terraform workspace/repo is ... quite annoying.
Yes, it's possible to disable it per workspace, but ... that is not normal for language extensions in my experience with vscode (or any other editor/IDE). The C++ tooling doesn't pop up notification toasts that it failed to compile my non-existent C++ code every time I open a TypeScript or Go workspace, for example.
I came here because I'm having the exact same problem as well.
I see the same issue in a workspace with different folders. In some folders I have terragrunt files, in some folders, I have non terraform related files.
like
| -- ansible
| -- terragrunt
| -- terraform_modules
Hi folks, I'm sorry you're running into that problem. Is anyone seeing this when they don't have either a terraform_modules directory or .tf files in a subdirectory of the workspace?
I guess I do have some .tf files buried _deep_ within one of the repos in my multi-repo workspace. But it complains about a different repo (the first one in the workspace).
Also, even if I _do_ do terraform init ... it _still_ complains. But I think that is covered by e.g. #366 and others
Hi folks, I'm sorry you're running into that problem. Is anyone seeing this when they don't have either a
terraform_modulesdirectory or .tf files in a subdirectory of the workspace?
yes, i'm seeing this on several folders have no .tf or terraform_modules in them.
i load a large workspace with many different repos
Hi folks, I'm sorry you're running into that problem. Is anyone seeing this when they don't have either a
terraform_modulesdirectory or .tf files in a subdirectory of the workspace?
@aeschright yes, I confirm too I'm seeing this problem in a leaf project (of my multi-root workspace) that has zero terraform_modules directory or .tf files in a subdirectory. Confirmed by running find -type f -name "*.tf" and find -type d -name "terraform_modules".
Also confirming https://github.com/hashicorp/vscode-terraform/issues/368#issuecomment-642288506 : the extension complains about the first repo in the multi-root workspace. If I edit my .code-workspace file, comment the first entry, and restart VSCode, then the extension will complain about the new/later first entry.
Available for more debug info.
I use terraform init per environment I deploy to, I too have this issue.
Yes, how to disable this?
I tried to run the command to disable the Language Server but it does not work, it keeps logging a bunch of errors in my console.
Is there a way to use this extension just for the syntax highlighting?
Thanks,
Is there a way to use this extension just for the syntax highlighting?
And code formatting? Running terraform format doesn't require the language server, but with the new release, if the language server fails to initialize, code formatting doesn't work.
I believe these issues are resolved in the latest versions of the VS Code extension / terraform-ls. Specifically issues with focus hijacking, initializing with no schema, formatting with no schema, etc.
We are still working to improve different workspace organization handling, the best tracking issue for that is https://github.com/hashicorp/terraform-ls/issues/32
I believe these issues are resolved in the latest versions of the VS Code extension / terraform-ls. Specifically issues with focus hijacking, initializing with no schema, formatting with no schema, etc.
Confirmed on my local install. After restarting Code, being prompted to install the latest tf-ls, and re-restarting, no more error. Thanks!
We are still working to improve different workspace organization handling, the best tracking issue for that is hashicorp/terraform-ls#32
👍👍👍
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.
Most helpful comment
I guess I do have some
.tffiles buried _deep_ within one of the repos in my multi-repo workspace. But it complains about a different repo (the first one in the workspace).Also, even if I _do_ do
terraform init... it _still_ complains. But I think that is covered by e.g. #366 and others