By oneangrydba
Claude Code plugin providing Terraform language server integration for code intelligence and diagnostics in .tf and .tfvars files
npx claudepluginhub oneangrydba/claude-terraform-lsp-pluginA Claude Code plugin that integrates terraform-ls (HashiCorp's official Terraform language server) for code intelligence, diagnostics, and completions in Terraform files.
The official Terraform MCP plugin by HashiCorp provides automation capabilities — running plans, managing state, and interacting with the Terraform ecosystem.
This plugin is complementary. It provides language intelligence while you edit — diagnostics, completions, hover documentation, and code navigation for .tf and .tfvars files. Both plugins can be installed together.
| Terraform MCP Plugin | Terraform LSP Plugin (this) | |
|---|---|---|
| Type | MCP server | LSP integration |
| Provides | Plan/apply automation, state management | Diagnostics, completions, hover docs |
| When it helps | Running and managing infrastructure | Writing and editing Terraform code |
| Extension | Language ID |
|---|---|
.tf | terraform |
.tfvars | terraform-vars |
Important:
terraform-lsmust be installed and on your PATH before using this plugin. Without it, the language server will fail to start and you will not receive diagnostics or completions for Terraform files. Claude Code does not install language servers automatically.
Install terraform-ls on your system.
brew install hashicorp/tap/terraform-ls
Download the latest release from HashiCorp Releases and place the binary on your PATH.
Download from HashiCorp Releases and add to your PATH.
terraform-ls -v
Once the plugin is listed in a marketplace, install with:
claude plugin install terraform-lsp
For local development, use the --plugin-dir flag:
claude --plugin-dir /path/to/claude-terraform-lsp-plugin
Once installed, Claude Code starts the terraform-ls language server when it encounters .tf or .tfvars files. The language server provides:
Ask Claude to add an aws_security_group resource to a .tf file. After writing the file, terraform-ls publishes diagnostics — for instance, flagging a reference to a VPC that doesn't exist in the configuration, or a syntax error in an HCL expression. Claude sees the diagnostic immediately and corrects the issue without needing to run terraform validate or terraform plan.
Ask Claude to create an RDS database instance. With the plugin enabled, terraform-ls provides completions for valid aws_db_instance attributes and hover documentation for each one. Claude uses this to write correct HCL with the right attribute names and types, rather than relying solely on training data that may be outdated for newer provider versions.
In a multi-file Terraform project, ask Claude to refactor a module or update a variable used across several files. The plugin provides go-to-definition and find-references, so Claude can trace where var.environment is declared, where it's used, and what resources depend on it — making the refactor accurate across the entire codebase.
Verify terraform-ls is installed and on your PATH:
which terraform-ls && terraform-ls -v
If the command is not found, follow the Prerequisites section above.
terraform init in your workspace — terraform-ls uses the provider schemas from .terraform/ to power completions and attribute validation. Without it, you'll get basic syntax support but not full code intelligence.Apache 2.0 — see LICENSE.
TypeScript/JavaScript language server for enhanced code intelligence
Share bugs, ideas, or general feedback.
C/C++ language server (clangd) for code intelligence
Java language server (Eclipse JDT.LS) for code intelligence
Memory compression system for Claude Code - persist context across sessions
C# language server for code intelligence
Python language server (Pyright) for type checking and code intelligence