Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
-diff option already prints the file where the problem was found so the file name is listed unnecessarily twice. -list=false should work the same even when running with -diff, e.g. names of files with errors should not be printed as they are also printed in the diff. This all combined with -check should work as one would expect. E.g. print the diff for not formatted files and fail with non-zero exit code.
Actual Behavior
Running terraform fmt with both -diff and -list=false causes the output to be empty (see Debug output ⬆️ ).
When running
terraform fmt
with following flags:-diff -list=false -check
the output is unexpectedly empty.Terraform Version
Terraform Configuration Files
Used in following outputs is this configuration:
But the issue is reproducible with any configuration.
Debug Output
Run with
-diff
only:Run with
-list=false
only:Run with neither:
Run with both ❗️:
Expected Behavior
-diff
option already prints the file where the problem was found so the file name is listed unnecessarily twice.-list=false
should work the same even when running with-diff
, e.g. names of files with errors should not be printed as they are also printed in the diff. This all combined with-check
should work as one would expect. E.g. print the diff for not formatted files and fail with non-zero exit code.Actual Behavior
Running
terraform fmt
with both-diff
and-list=false
causes the output to be empty (see Debug output ⬆️ ).Steps to Reproduce
.tf
fileterraform fmt -check -diff -list=false