This VS Code extension automatically formats Terraform files when you save them, using the terraform fmt
command.
- Automatically formats
.tf
and.tfvars
files on save - Uses the official
terraform fmt
command for formatting - Shows detailed error messages for invalid HCL syntax
- Cross-platform support (Windows, Linux, macOS)
- Visual Studio Code 1.60.0 or higher
- Terraform CLI installed and available in your system PATH
This extension doesn't require any additional settings.
- The terraform CLI must be installed and accessible in your system PATH
- Formatting may take a moment on larger files
- You might see a warning about "No view is registered with id: terraform.cloud.run.apply" - this can be safely ignored as it's related to the official HashiCorp Terraform extension, not this formatting extension
- Added 500ms delay before formatting to prevent conflicts with HashiCorp's Terraform extension
- Added protection against concurrent formatting operations on the same file
- Improved error handling and user feedback for various Terraform syntax errors
- Improved error messages for invalid HCL syntax
- Added specific error messages for common Terraform formatting issues
- Removed debug logging for production release
Initial release of Terraform Format extension