-
Notifications
You must be signed in to change notification settings - Fork 180
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
Support multiple Terraform folders in a single workspace #330
Comments
For now I just move my TF folder to the top of the list and it all works ok, so I'm guessing there are just some assumptions somewhere that are incorrect about what folders to pass/use. |
This would also be the case for a single-folder workspace that has multiple terraform projects inside it;
|
@forstermatth in that case, you |
Yep; we have a couple scripts within the repo's package.json right now for commit hooks, which give a good example. "scripts": {
...
"terraform:validate": "cd ${WORKING_DIR} && terraform init -input=false -backend=false > /dev/null && terraform validate",
"validate:production": "WORKING_DIR=./terraform/production npm run terraform:validate && echo ✅ validate:production success",
"validate:staging": "WORKING_DIR=./terraform/staging npm run terraform:validate && echo ✅ validate:staging success",
"validate:west": "WORKING_DIR=./terraform/west npm run terraform:validate && echo ✅ validate:west success",
"validate:vault": "WORKING_DIR=./terraform/vault-config npm run terraform:validate && echo ✅ validate:vault success"
} |
@paultyng yes. This is an extremely common pattern with Terraform. All of my repos that aren't just modules to be consumed elsewhere have multiple projects in a single repo. We use Atlantis to manage it, or cd into the project we're working with at that time. The language server started by @juliosueiras https://github.com/juliosueiras/terraform-lsp didn't have these problems at all |
@smiller171 you can change the LS binary you are using to use Julio's (we are also working with him on ours). The terraform-ls project has different limitations than terraform-lsp (you can review them in the README for the ls), as the ways Julio is interacting with Terraform are version specific and not the supported interface for interacting with it. |
I get that, but the limitations for |
I think maybe an option to select which language server to use for this release until those issues are resovled? |
I wrote up #335 to see if we can add something in the configs or extension prior to release to allow people to more easily choose/install, especially now while the feature sets diverge more. |
It may be useful to have it as a VSCode workspace settings where I point where it should expect terraform roots. These are my usual repo structures with
or when it is project based
To be honest I do not have any repo where |
Was it not an option to release a beta version as an extension file (VSIX? I'm not an expert here) which courageous volunteers can manually install before pushing this huge deal-breaker regression to the whole world? Cf. microsoft/vscode#15756 |
@nodakai They did, and several of us told them explicitely that this shouldn't be released as-is |
I think recent update is a breaking change and it was quite rush to switch while the language server is just being developed since Feb.
Agreed and I got that from experience restructuring project(s) over time. It will reduce time to refresh a lot of states, different providers version and focus on application specific resources. Just use Things like VPC, subnets, route tables, some IAM policies and CI/CD is a lot and less frequent to change compare to application infra. Some simple application using lambda + API gateway while other applications using Kubernetes/Helm. So it is incomplete without this support with or without workspace. Anyway it seems promising after seeing this hashicorp/terraform-ls#167 |
Same issue. We use a mono-repo structure similar to:
This extension is totally broken for us right now |
As a workaround you can add a terraform project as the first listed folder in your vscode workspace. That should get you working until the fix is released. |
Linking this to another relevant tracking issue on the LS: hashicorp/terraform-ls#32 |
Keep in mind there is also hashicorp/terraform-ls#128 which you may still run into - workaround is mentioned in the thread. |
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. |
I have a "workspace" in VSCode that has multiple folders (in this case, one was the LS, and one was a TF config, but also when working on a provider I have the provider Go code and a TF config folder open).
If the TF folder is not the first one listed, the terraform init / working dir provider to the LS is incorrect. I'm not sure if this is an LS bug, a VS Code extension bug, or both?
The text was updated successfully, but these errors were encountered: