A Prettier plugin that formats Terraform files by shelling out to the local `terraform fmt` command. Version 1.2.1 is the current stable release, with a maintenance cadence. Unlike other Terraform formatters (like `terraform fmt` directly), this integrates with Prettier workflows and respects Prettier's file matching and option system. The Terraform CLI must be installed separately. Supports `terraformStrictError` option to control error behavior when terraform is not found.
npm install prettier-plugin-terraform-formatterVerified import paths — ran on the pinned version, not inferred.
Install plugin, set up config with terraform parser override, then format files via CLI.
Set 'terraformStrictError' to true to treat all failures as errors, or ensure terraform is installed and in PATH.
Consider running terraform fmt directly for bulk formatting, or use Prettier's caching.
Ensure consistent terraform version across team (e.g., via tfenv or Docker).
Run: npm install prettier-plugin-terraform-formatter as a dev dependency.
Ensure plugins field is an array: 'plugins': ['prettier-plugin-terraform-formatter']
Install Terraform (e.g., via tfenv or hashicorp tap) and ensure it's executable.