To check if all code in a Terraform configuration with multiple modules is properly formatted without making changes, what command should be run?
To check if all code in a Terraform configuration with multiple modules is properly formatted without making changes, what command should be run?
To check if all code in a Terraform configuration with multiple modules is properly formatted without making changes, you should use the command 'terraform fmt -check -recursive'. The '-check' flag verifies formatting without making any changes, and the '-recursive' flag ensures that the command is applied to all directories and subdirectories, covering all modules.
terraform fmt takes followong options Options: -list=false Don't list files whose formatting differs (always disabled if using STDIN) -write=false Don't write to source files (always disabled if using STDIN or -check) -diff Display diffs of formatting changes -check Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise. -no-color If specified, output won't contain any color. -recursive Also process files in subdirectories. By default, only the given directory (or current directory) is processed.
-check -recursive should check all formatting without modifying the configuration files.
-check Check if the input is formatted. Exit status will be 0 if all input is properly formatted and non-zero otherwise. -recursive Also process files in subdirectories. By default, only the given directory (or current directory) is processed. answer for me is D
terraform fmt -check -recursive, recursively checks all modules and submodules for the format.
The answer is C.
The answer is D.
"fmt -> without making changes" So, I will go with D (make sure)