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

-no-color breaks terraform providers schema -json command #226

Closed
sudomateo opened this issue Jul 10, 2020 · 1 comment · Fixed by #227
Closed

-no-color breaks terraform providers schema -json command #226

sudomateo opened this issue Jul 10, 2020 · 1 comment · Fixed by #227
Labels
bug Something isn't working

Comments

@sudomateo
Copy link

sudomateo commented Jul 10, 2020

The -no-color argument introduced in #208 does not allow terraform-ls to retrieve schemas using terraform providers schema -json since it injects the -no-color argument, making the executed command terraform providers -no-color schema -json which throws an error.

Server Version

0.5.0

Terraform Version

Terraform v0.12.28

Client Version

NVIM v0.4.3 with coc.nvim.

{
  "languageserver": {
    "terraform": {
      "command": "terraform-ls",
      "args": [
        "serve"
      ],
      "filetypes": [
        "terraform",
        "tf"
      ],
      "initializationOptions": {},
      "settings": {}
    }
  }
}

Terraform Configuration Files

provider "aws" {}

Log Output

2020/07/10 15:32:52 exec.go:178: Starting /Users/redacted/.local/bin/terraform ["terraform" "providers" "-no-color" "schema" "-json"] in "/Users/redacted/testing"...
2020/07/10 15:32:52 exec.go:144: Waiting for command to finish ...
2020/07/10 15:32:53 root_module.go:453: failed to update plugin cache for /Users/redacted/testing: Unable to retrieve schemas for "/Users/redacted/testing": failed to get schemas: terraform (pid 10436) exited (code 1): exit status 1
stdout: ""
stderr: "Too many command line arguments. Configuration path expected.\n"

Expected Behavior

The terraform providers schema -json command should successfully execute and allow terraform-ls to load the schemas.

Actual Behavior

The terraform providers schema -json command throws the error Too many command line arguments. Configuration path expected.\n since the -no-color argument is injected in the wrong place. This leaves the terraform-ls binary unable to load schemas.

Switching back to terraform-ls version 0.4.1 works.

Perhaps switching the command to terraform providers schema -json -no-color would work since that's a valid command or removing -no-color from this command.

Steps to Reproduce

  1. Configure your Vim/Neovim setup with coc.nvim per the above configuration.
  2. Create a main.tf with the above content.
  3. Execute terraform init as required by terraform-ls.
  4. Edit themain.tf file to let terraform-ls initialize.
  5. Notice that completion is not working.
  6. View the logs for terraform-ls either running terraform-ls with -log-file or using the :CocInfo Vim/Neovim command.
@sudomateo sudomateo changed the title -no-color breaks terraform providers schema command -no-color breaks terraform providers schema -json command Jul 10, 2020
@radeksimko radeksimko added the bug Something isn't working label Jul 10, 2020
@ghost
Copy link

ghost commented Aug 9, 2020

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 and limited conversation to collaborators Aug 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants