-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Workspace not initialized" error when vscode is opened from a superdirectory #366
Comments
Same issue here, my work has a Terraform monorepo for all of our IaC. I tried adding the |
Same here. Terraform configuration is not in the root but in a sub directory as the Terraform code is just part of the wohle project. This problem makes the extension actually useless for all my projects now. ☹ What makes it even worse it that this new behavior is not noted anywhere in the release notes. Furthermore no real workaround seems to be available, right now. I do not know what has changed that the behavior is now that different but it makes the current version of the extension worse that the previous! So please fix that immediately. Please also understand that very often the Terraform code is part of a whole project and the project consists not only of some .tf files in the root. (Apart some very simple, not real world, examples maybe.) So the extension must support that out of the box. |
Also experiencing this, would be really handy to have an option to specify the directory where the Terraform scripts are. |
@J0F3 You can disable it for now by setting the
|
@dimisjim Yes, I know. But does not help me either. I do not want do disable the language server. The point is, that I had a working Terraform 0.12 support in VS Code with the extension and now, since the new version, the extension does basically not work in any of my projects anymore. |
Previous extension version was also not working (at least for tf v0.12). |
previous version worked just fine for me with 0.12 |
That's bizarre. The reason why the language server project was created and the whole point of this ongoing development was that the existing extension did not support hcl2 (tf 0.12.x) What features were working in the previous version for you? |
@dimisjim more like what wasnt! |
all you had to do was to follow #157 |
You are referring to a huge issue thread. What exactly did you have to follow for it to work perfectly? |
where the previous dev kept releasing updates to the LS and the extension
error detection, linting, fmt. but to not flag broken resources? not be able to fmt my code automatically on save? |
ok I might have missed it then and assumed it was never really there as it was never officially released and always deemed experimental by the developers themselves. In any case, it doesn't change the fact that the current 2.0.1 is more like 0.0.1 than 2.x.x |
v2 doesnt work. period |
Agreeing with the above sentiments. Pre-2.0.0 the language server crashed occasionally but otherwise was auto-formatting and auto-completing my 0.12 definitions. I almost exclusively have my Terraform in |
100% i cannot believe this was pushed out without consideration of using TF in subdirectories. SMH |
I understand everyone's frustration (I'm one), but as it's stated here the new module/terraform-ls does not support nested modules (sub-dirs). That being said, I found a very simple workaround that works well for me. I added a single I believe that's what terraform-lsp inside your |
tried it, getting same error |
Make sure you run
|
Ok works this way, but you still get this annoying change of focus in the output tab down below, basically this: #371 |
@dimisjim, I haven't run into the annoying change of focus in the output tab yet. but I will be writing some code later today. I will share my final experience with the server being enabled! |
@nbetm This does work - its a bit of a hack, but i'll do for now! 👍 |
There is a "Terraform (forked)" extension (l2fprod.terraform-fork v1.4.28) by Frederic Lavigne that seems to be a fork of Mikael Olenfalk's v.1.4 release. I have switched to this until this issue or the upstream version pinning issue are fixed. |
Confirming that this: #366 (comment) works as a stopgap |
Going to close this to merge in with the existing initalization issues or the main folder structure issue: hashicorp/terraform-ls#32 (comment) |
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. |
terraform version: 0.12.24
terraform-vscode: 2.0.1
os: ubuntu 20.04
I am running vscode that contains multiple repos and directories. A few directory levels beneath, there is a terraform workspace.
Actual Behavior
Expected Behavior:
Language server automatically being able to detect the terraform workspace in one of the subdirectories, OR having the ability to define it in the Global or Workspace specific settings json, for example, something like:
Similar to #329 but this one assumes that vs workspace is >= 1 levels above the root terraform workspace.
The text was updated successfully, but these errors were encountered: