terraform-lsp

command module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 21 Imported by: 0

README

Terraform LSP

Gitter terraform version Nix Build FOSSA Status

This is LSP(Language Server Protocol) for Terraform

NOTE: This is first stage of the plugin, so is experimental

asciicast

Building

Native
  • download go modules GO111MODULE=on go mod download
  • run make or go build
Nixpkgs
  • install nixpkgs
  • nix-build

Currently Supported

  • Variables complex completion(infinite nesting type)
  • Provider Config completion
  • Resource(with infinite block, looking at you kubernetes provider ;) ) completion
  • Data source completion
  • Dynamic Error Checking(Terraform and HCL checks)
  • Communication using provider binary(so it will support any provider as long as is built with terraform 0.12 sdk)
  • Module nesting(inifinte as well) variable completion

Todo-List (Main)

  • A lot of code clean up(right now is mostly getting the feature done)
  • CI/CD(Travis)
  • Tests
  • Getting Started Guide
  • Add Gifs & Asciinema for Demo
  • Cross Compile for Windows Binary

Todo-List (Terraform)

  • Add Provider Listing(static list)

  • Provider Configs

  • Resources

    • Provider attribute scope completion(ex. google vs google-beta)
  • Data Sources

  • Backends (current focus)

  • Provisioner (current focus)

  • Interpolations

    • Complex nesting interpolations
  • Modules

  • Locals

  • Outputs

  • Variables

    • Map Interpolation with Object inside
    • Index Interpolation
    • List Interpolation with Object inside
    • Object Interpolation
    • Functions
  • Dynamic Block

    • For Each Block
      • Check for complex scenario

Todo-List (LSP)

  • initialize
  • textDocument/completion
  • textDocument/didChange
  • textDocument/didOpen
  • textDocument/publishDiagnostics
  • Current Plan: Implement all possible LSP features

Editors Specific

VS Code
Issues
  • Need syntax and highlight etc (possible collab with vscode-terraform?)
Atom
Issues
  • Need configuration for linter API
Intellij
  • Work with intellij-lsp plugin(also work with intellij-hcl together)
Vim
  • Should work with all lsp plugin on vim
Emacs
  • Work with emacs-lsp/lsp-mode while still a little buggy
    (add-to-list 'lsp-language-id-configuration '(terraform-mode . "terraform"))
    
    (lsp-register-client
     (make-lsp-client :new-connection (lsp-stdio-connection '("/path/to/terraform-lsp/terraform-lsp" "-enable-log-file"))
                      :major-modes '(terraform-mode)
                      :server-id 'terraform-ls))
    
    (add-hook 'terraform-mode-hook #'lsp)
    
Others
  • It should work with any lsp client in theory

Bugs

  • Order of completion items
  • Issue with block

Credits

License

FOSSA Status

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Mostly adapted from tfschema - https://github.com/minamijoyo/tfschema
Mostly adapted from tfschema - https://github.com/minamijoyo/tfschema

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL