Skip to content

The one and only agent harness for complex codebases. Project memory, planning, execution, and verified completion inside Codex.

2.2 KB
Raw Blame

Terraform — LSP setup

An alias id terraform-ls exists with the identical command; either id works.

Install

  • macOS: brew install hashicorp/tap/terraform-ls
  • Linux: download a release from https://github.com/hashicorp/terraform-ls/releases and place terraform-ls on PATH (or apt/dnf via the HashiCorp repo)
  • Windows: choco install terraform-ls (or download a release zip)

terraform-ls requires the terraform binary itself to be installed and on PATH.

Confirm both resolve:

command -v terraform-ls
command -v terraform

Configure

Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in every harness's project config (per-harness paths: the Configure step in SKILL.md):

{ "lsp": { "terraform": { "priority": 100 } } }

For builtin ids in a PROJECT config, command is supplied automatically — only set priority/initialization/extensions/disabled (a project entry drops env). env, and a fully custom (non-builtin) server with its own command, must go in your harness's USER config (see the Configure step in SKILL.md).

Initialization options (only if commonly needed)

None commonly required. Provider/module completion comes from schemas generated by terraform init. Run it in each module root before expecting full completion:

terraform init

To force schema indexing, you can set experimental features via initialization:

{ "lsp": { "terraform": { "initialization": { "experimentalFeatures": { "validateOnSave": true } } } } }

Alternatives

  • tflint standalone for opinionated linting (complements the LSP).
  • terraform fmt for formatting.

Troubleshooting

  • PATH: terraform-ls AND terraform both on PATH; reopen shell after install.
  • No provider completion: run terraform init so the .terraform/ schema cache exists.
  • .tfvars not analyzed: open the containing module so the server has root context.

Verify

bun ../../scripts/verify-lsp.ts path/to/file.tf