Exam Terraform Associate All QuestionsBrowse all questions from this exam
Question 127

To check if all code in a Terraform configuration with multiple modules is properly formatted without making changes, what command should be run?

    Correct Answer: D

    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.

Discussion
RVivekOption: D

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.

jabbawockie12Option: D

-check -recursive should check all formatting without modifying the configuration files.

zyxphreezOption: D

-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

Pinky0289Option: D

terraform fmt -check -recursive, recursively checks all modules and submodules for the format.

Pinky0289

The answer is C.

ptR95

The answer is D.

Anderson01Option: D

"fmt -> without making changes" So, I will go with D (make sure)