juliosueiras / terraform-lsp

Language Server Protocol for Terraform
MIT License
578 stars 37 forks source link

No completion with terraform init message #88

Open mcinquin opened 3 years ago

mcinquin commented 3 years ago

Hi,

I have a particular terraform directory structure

terraform
|-- environment
     |-- test
          |-- main.tf
          |-- .terraform
     |-- valid
|-- modules
     |-- gcp
          |-- vpc
               |-- main.tf  
               |-- outputs.tf
               |-- variables.tf
     |-- local
|-- templates

If I create or edit a file in the terraform/environment/test the completion is working well but if I work in the terraform/modules, the completion doesn't work and I have the following message: google_ Did You Forgot to do terraform init? [LS].

I guess it's because he can't find the .terraform file.

How to configure the path where it can find the .terraform folder ?

Regards.

Environment

juliosueiras commented 3 years ago

interesting, since the current implementation, it searches for .terraform up the directories, but in your use case, it is in a neighboring directory

juliosueiras commented 3 years ago

what I can do instead, if is sound good to you, I will add a configuration option, like a file .terraformlsprc that will have the option of specifying .terraform folder location

mcinquin commented 3 years ago

Hi,

Sounds good to me.

Just a little question: how to enable the debug?

Regards.

mcinquin commented 3 years ago

any news about this enhancement?

will-ockmore commented 3 years ago

This would be a fantastic addition. I'm running into a very similar issue with several environments in a sibling directory, which all use a set of shared modules. As most places seem to structure their terraform code differently (no consistent standard), a configuration option for this seems like the most straightforward approach

mcinquin commented 3 years ago

up ?