# Terraform Language Server (terraform-ls) # Official HashiCorp LSP for Terraform # https://github.com/hashicorp/terraform-ls FROM alpine:3.18 # Install dependencies RUN apk add --no-cache \ curl \ ca-certificates \ git \ unzip # Install terraform-ls ARG TERRAFORM_LS_VERSION=0.38.4 RUN curl -fsSL https://releases.hashicorp.com/terraform-ls/${TERRAFORM_LS_VERSION}/terraform-ls_${TERRAFORM_LS_VERSION}_linux_amd64.zip \ -o terraform-ls.zip && \ unzip terraform-ls.zip && \ mv terraform-ls /usr/local/bin/ && \ chmod +x /usr/local/bin/terraform-ls && \ rm terraform-ls.zip # Set up working directory WORKDIR /workspace # Run terraform-ls in stdio mode ENTRYPOINT ["terraform-ls", "serve"]