Sort Terraform variables, outputs, and blocks in consistent order.
CLI to sort Terraform variables and outputs
tfsort
$ tfsort main.tf
$ tfsort -w main.tf
$ tfsort *.tf
$ tfsort main.tf > /dev/null && echo 'sorted'
$ tfsort -w .