Skip to content
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

Allow opt out of "No root module found" warning #212

Closed
stevenpitts opened this issue Jul 7, 2020 · 9 comments
Closed

Allow opt out of "No root module found" warning #212

stevenpitts opened this issue Jul 7, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@stevenpitts
Copy link

Server Version

I'm unsure, as I don't have terraform-ls installed directly, I have the VS Code extension, v2.02

Terraform Version

0.12.28

Client Version

VSCode 1.46.1

I'd like to turn #205 (comment) into an issue; I should be able to opt in (or out) of getting the "No root module found" warning.
My reason for this is that I use Terragrunt, and I don't want to have to manually init every root I work on. All I want is the syntax checking and formatting.

@radeksimko radeksimko added the enhancement New feature or request label Jul 8, 2020
@radeksimko
Copy link
Member

Thanks for creating the issue @makusu2

My reason for this is that I use Terragrunt, and I don't want to have to manually init every root I work on.

As far as I can tell Terragrunt can/does run terraform init too. Do you mind expanding the context here a bit?

As mentioned in the linked comment I'm not against adding the config option, but I'd like to better understand what kind of scenarios is it meant to support and tailor the docs and UX towards these. Relatedly I'd not want to see such option being used to overcome problems/bugs related to any common scenarios.

@stevenpitts
Copy link
Author

@radeksimko I can run terragrunt init, but terragrunt plan runs it automatically when it needs to be run, so you don't usually run it manually.
Also, when I run terragrunt init, I believe the data is stored with the Terragrunt (.hcl) files, not with the Terraform (.tf) files, so I still get the warning when I open a Terraform file. That reason is just a guess, though.

@radeksimko
Copy link
Member

Also, when I run terragrunt init, I believe the data is stored with the Terragrunt (.hcl) files, not with the Terraform (.tf) files, so I still get the warning when I open a Terraform file. That reason is just a guess, though.

As far as I understand terragrunt init (assuming that it eventually runs terraform init in some form or shape, which I'm fairly sure it does) will still store the plugin cache and module manifest somewhere on the disk, and it would not be in the form of HCL or TF config, but the exact same format that the language server would look for and understand.

The only thing I don't know given my limited experience with Terragrunt is where would that be and how would the location of either module or plugin cache correspond to the location of files being edited.

I wouldn't be too opposed to exploring support of such setup so that the server can still provide all features, but supporting it may not be trivial and so I would be happy to add a config option to ignore this warning.

Also we plan to explore ways of obtaining the schema remotely as per #193

@FernandoMiguel
Copy link

it's inside a folder .terragrunt-cache
similar to .terraform

@sukoneck
Copy link

I would love to be able to opt-out. Sometimes I need to just browse around local copies of repos that should not have any of the .terraform stuff and it would be great to not be blasted with that notification.

@ssttgg
Copy link

ssttgg commented Feb 2, 2021

@radeksimko is there any news on this yet? This popup can seriously spoil the vscode-terraform experience, it makes it almost unusable. For evidence please see #221, #383, hashicorp/vscode-terraform#447, hashicorp/vscode-terraform#524, hashicorp/vscode-terraform#544.

I appreciate from your other replies that you wish to "solve" this and try to model all scenarios that might cause this to show, but clearly that's not trivial and will take some time - in the mean time please do not overlook the small mercy of allowing users to disable this clearly contentious popup.

@trilom
Copy link

trilom commented Feb 9, 2021

I agree with @ssttgg above, the message is in reality the only underlying problem other than all the logging the ls server spits out that might waste cycles.

I am attempting to implement what I see as a very common solution to this problem by just excluding certain rootModules from being considered is not working as I would expect it to at all.

For example consider the following directory structure:

../packer-plugin-scaffolding
├── LICENSE
├── README.md
├── file.fedora.pkr.hcl
└── provisioner
    ├── file.fedora.pkr.hcl
    └── scaffolding
        ├── file.fedora.pkr.hcl

WIth the inputs: "terraform-ls.rootModules": ["NOTpacker-plugin-scaffolding"], it will still include this directory for the hcl files.
With the inputs: "terraform-ls.excludeRootModules": ["packer-plugin-scaffolding"], it will still include this directory for the hcl files.

I have tried various "secret formulas" based on docs for / path and ~ or even explicit /User/blah/repo location and trying a wildcard file:///User/blah/repo and none give expected results. There might be a formula, but there shouldn't be one Mr. Krabs.

I know this(hcl-lang) is going on concurrently to produce schemas, I don't know much about the work that needs to be done but basically I just want to use the vs-code plugin (terraform-ls) to provide input validation for humans via VS Code and the machine way I see that might reproduce that functionality at least on a very barebones way would be to only pop that message if the file is *.tf but do everything else if it's *.nomad|hcl|pkr.

@radeksimko
Copy link
Member

Hi folks,
The issue is not addressed yet, but we have a plan for addressing it and I'm just merging all the issues with the same root cause, such as this one, into a single issue: #424

Thank you for your understanding and patience.

@ghost
Copy link

ghost commented Mar 27, 2021

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.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants