terraform-lsp icon indicating copy to clipboard operation
terraform-lsp copied to clipboard

No completion with terraform init message

Open mcinquin opened this issue 3 years ago • 6 comments

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

  • terraform-lsp v0.0.11-beta2
  • coc
  • vim 8

mcinquin avatar Oct 21 '20 15:10 mcinquin

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

juliosueiras avatar Oct 21 '20 16:10 juliosueiras

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

juliosueiras avatar Oct 21 '20 16:10 juliosueiras

Hi,

Sounds good to me.

Just a little question: how to enable the debug?

Regards.

mcinquin avatar Oct 22 '20 08:10 mcinquin

any news about this enhancement?

mcinquin avatar Nov 20 '20 14:11 mcinquin

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

will-ockmore avatar Dec 23 '20 12:12 will-ockmore

up ?

mcinquin avatar May 12 '21 14:05 mcinquin