{
  "markdown": "# Terraform LSP Plugin for Claude Code\n\nA [Claude Code](https://claude.com/claude-code) plugin that integrates [terraform-ls](https://github.com/hashicorp/terraform-ls) (HashiCorp's official Terraform language server) for code intelligence, diagnostics, and completions in Terraform files.\n\n## How This Differs from the Terraform MCP Plugin\n\nThe official [Terraform MCP plugin](https://github.com/anthropics/claude-plugins-public/tree/main/external_plugins/terraform) by HashiCorp provides automation capabilities — running plans, managing state, and interacting with the Terraform ecosystem.\n\nThis 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.\n\n| | Terraform MCP Plugin | Terraform LSP Plugin (this) |\n| --- | --- | --- |\n| **Type** | MCP server | LSP integration |\n| **Provides** | Plan/apply automation, state management | Diagnostics, completions, hover docs |\n| **When it helps** | Running and managing infrastructure | Writing and editing Terraform code |\n\n## Supported File Types\n\n| Extension | Language ID |\n| --------- | ----------- |\n| `.tf` | `terraform` |\n| `.tfvars` | `terraform-vars` |\n\n## Prerequisites\n\n> **Important:** `terraform-ls` must 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.\n\nInstall `terraform-ls` on your system.\n\n### macOS (Homebrew)\n\n```sh\nbrew install hashicorp/tap/terraform-ls\n```\n\n### Linux\n\nDownload the latest release from [HashiCorp Releases](https://releases.hashicorp.com/terraform-ls/) and place the binary on your PATH.\n\n### Windows\n\nDownload from [HashiCorp Releases](https://releases.hashicorp.com/terraform-ls/) and add to your PATH.\n\n### Verify Installation\n\n```sh\nterraform-ls -v\n```\n\n## Install Plugin\n\nOnce the plugin is listed in a marketplace, install with:\n\n```sh\nclaude plugin install terraform-lsp\n```\n\nFor local development, use the `--plugin-dir` flag:\n\n```sh\nclaude --plugin-dir /path/to/claude-terraform-lsp-plugin\n```\n\n## Usage\n\nOnce installed, Claude Code starts the `terraform-ls` language server when it encounters `.tf` or `.tfvars` files. The language server provides:\n\n- **Diagnostics** — syntax errors, missing references, validation\n- **Completions** — resource types, attribute names, built-in functions\n- **Hover** — documentation for resources and attributes\n\n## Examples\n\n### Catching errors immediately after edits\n\nAsk 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`.\n\n### Writing accurate Terraform with provider-aware completions and hover\n\nAsk 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.\n\n### Navigating a large Terraform codebase with go-to-definition\n\nIn 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.\n\n## Troubleshooting\n\n### Language server not starting\n\nVerify `terraform-ls` is installed and on your PATH:\n\n```sh\nwhich terraform-ls && terraform-ls -v\n```\n\nIf the command is not found, follow the [Prerequisites](#prerequisites) section above.\n\n### Limited completions or missing provider attributes\n\n- Run `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.\n\n## License\n\nApache 2.0 — see [LICENSE](LICENSE).\n",
  "bytes": 4455,
  "sha": "f988b8014059091831ab53599bef3a7c603645879fa48ed7f91b3a03c02b8086",
  "repo_slug": "oneangrydba/claude-terraform-lsp-plugin",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_oneangrydba_claude_terraform_lsp_plugin__b9842ecb/readme"
}