packages/shared-skills/skills/lsp-setup/references/terraform/README.md
terraform — terraform-ls serve.tf .tfvarsAn alias id terraform-ls exists with the identical command; either id works.
brew install hashicorp/tap/terraform-lsterraform-ls on PATH (or apt/dnf via the HashiCorp repo)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
Builtin — usually NO config needed (auto-resolved by extension). Configure only to set priority, init options, override extensions, or disable. Same JSON shape in .codex/lsp-client.json (Codex) AND .opencode/lsp.json (OpenCode/omo):
{ "lsp": { "terraform": { "priority": 100 } } }
For builtin ids in a PROJECT config, command is supplied automatically — only set priority/initialization/extensions/disabled/env. A fully custom (non-builtin) server with its own command must go in the USER config (~/.codex/lsp-client.json).
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 } } } } }
tflint standalone for opinionated linting (complements the LSP).terraform fmt for formatting.terraform-ls AND terraform both on PATH; reopen shell after install.terraform init so the .terraform/ schema cache exists..tfvars not analyzed: open the containing module so the server has root context.bun ../../scripts/verify-lsp.ts path/to/file.tf