nmlc / terraform-lsp

Language Server Protocol for Terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Language Server Protocol for Terraform

License:MIT License


Languages

Language:Go 98.5%Language:Nix 0.8%Language:Shell 0.5%Language:Makefile 0.1%