By OneAngryDBA
Claude Code plugin providing Terraform language server integration for code intelligence and diagnostics in .tf and .tfvars files
A 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.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub oneangrydba/claude-terraform-lsp-pluginComprehensive daily task, project, and life management system using the PARA method. Transform messy thoughts into organized tasks, track projects with goals and timelines, manage areas of responsibility with habits/maintenance/obligations, and maintain a daily workflow with automatic rollover. Includes 22 slash commands, 6 proactive skills, workspace locking for concurrent session safety, and support for recurring items with consequence tracking.
Terraform module creation and infrastructure planning
Terraform configuration validation and infrastructure-as-code best practices
Terraform language server
Terraform and Terraform Cloud - infrastructure as code
Build reusable Terraform modules
Terraform code generation skills including HCL generation, style guides, and testing.