Run the command below to return the filenames that need formatting correction:
terraform fmt -check
To check a file under sub-directories (if any), append the -recursive flag. Example:
terraform fmt -check -recursive
To preview the changes try running the terraform fmt command with the -diff flag:
terraform fmt -check -diff
The lines that start with - are the original (current configuration) code. The lines beginning with + show the proposed changes to the code.terraform fmt