Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate 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?

Show Answer
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

5 comments
Sign in to comment
RVivekOption: D
Sep 26, 2024

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
Sep 3, 2024

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

zyxphreezOption: D
Sep 2, 2024

-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

Pinky0289
Sep 13, 2024

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

Pinky0289
Sep 13, 2024

The answer is C.

ptR95
Sep 20, 2024

The answer is D.

ptR95
Sep 20, 2024

The answer is D.

Anderson01
Oct 24, 2024

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