vscode-terraform: Can't format files after upgrade to 2.0.1
There seems to be no option to format .tf .tfvars .hcl files after the upgrade anymore 😦
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 17 (5 by maintainers)
This sounds like the same problem I am having with the 2.0 release. It require that the root of the VS Code workspace contains an
inited TF directory. But in my case I have a IaC repo that contains many subdirectories, some of which container TF code, while the top of the workspace does not. I assume this is most common use case. Opening each individual TF directory as a separate VS Code workspace would be tedious.I am trying to find some sort of documentation or discussion of this, but so far no joy.
Echoing @larslevie’s point - I work primarily in a Git repo where there are multiple isolated Terraform environments in separate folders, along with a
modulesfolder that, by design, contains reusable components that are meant to be reused across different environments.In order for the 2.0.1 language server to even function, it expects me to have ran
terraform initin the root of my workspace. This isn’t feasable because there are many different Terraform environments in the repo. The only way to even get it to function is to change my workflow to have separate workspaces for each of those Terraform environments. But if I’m working in code in the shared modules folder - which can’t really beterraform init-ed, then I’m stuck.@radeksimko so should look like this?