// plugins
Terraform Plugin
Wrapper plugin that formats Terraform, OpenTofu, and HCL files. It runs HCL's own code compiled to Wasm, along with the formatting logic of tofu fmt from OpenTofu.
Formats .tf, .tofu, .tfvars, .tftest.hcl, and .tofutest.hcl files exactly like tofu fmt, and other .hcl files (ex. Packer, Nomad, and Terragrunt configuration) like hclfmt. To leave some .hcl files alone, add them to excludes in your dprint config.
Install and Setup
In your project's directory with a dprint.json file, run:
dprint add terraform
This will update your config file to have an entry for the plugin.
{
"plugins": [
"npm:@dprint/terraform@x.x.x"
]
}
Configuration
There's nothing to configure, since tofu fmt and terraform fmt have no style options. Like them, the plugin keeps each file's newlines as they are.