Recommended configuration for multiple root modules in a repo?

I’ve been using the Terraform extension in VSCode for a long while now, and while it works fine if I have an incredibly simple single module open, it quickly falls over and takes minutes to format a file if I open any reasonably sized project. It’s gotten to the point where I reflexively hit ‘cancel’ when vscode pops up to say it’s waiting on code actions from the terraform extension.

I imagine the reason the extension is having so much trouble in my larger projects is because I just have one big folder full of modules.

For reference, I’m using the pre-release version of the extension (I’ve tried both release and pre-release with no appreciable difference) with the language server version 0.31.3, vscode 1.80.1, on a Windows host connecting to local WSL running Ubuntu.

Having recently started a new project, I really want to solve this to make the extension usable. I’ve read through the Readme for the extension and had trouble understanding how to configure my workspace for the language server to be able to work efficiently. This is my projects layout (as a screenshot because this forum apparently didn’t like my formatting):


With the only open workspace being the project directory, the language server (version 0.31.3) lags considerably, pushing thousands of lines into the log output. It also walks through all of my node_modules folders, despite these being ignored with
terraform.languageServer.ignoreDirectoryNames in my user settings.json, my workspace settings.json, my actual .code-workspace file, and my remote settings.

I tried setting terraform.languageServer.rootModules, but it pops up telling me its deprecated and I should use workspaces instead. With the above layout, I’m not entirely sure how to set these workspaces up.

Does anyone have any advice to complement the readme?

I managed to seemingly resolve this by removing all settings related to Terraform, reverting back to the stable version of the extension (2.27 with terraform-ls 0.31.3), and in my user settings.json:

“terraform.experimentalFeatures.prefillRequiredFields”: true,
“terraform.experimentalFeatures.validateOnSave”: true,
“terraform.languageServer.ignoreDirectoryNames”: [

and workspace settings.json:

“terraform.languageServer.rootModules”: [

I imagine this will break if the pre-release moves forward with disabling root modules, but we’ll see.