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

Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?

    Correct Answer: C

    To check if all code in a Terraform configuration that references multiple modules is properly formatted without making any changes, you should use the 'terraform fmt -check -recursive' command. The '-check' option ensures that the command only checks the formatting and returns a non-zero exit code if any files are not properly formatted, without making changes. The '-recursive' option allows the command to include all sub-directories, which is essential for configurations that reference multiple modules.

Discussion
seifsklOption: C

C. terraform fmt -check -recursive The terraform fmt -check -recursive command checks if the files are formatted according to the Terraform language style conventions. The -check option will make the command return a non-zero exit code if any of the files are not properly formatted, and the -recursive option instructs it to go into the sub-directories as well, which is useful when you have a Terraform configuration that references multiple modules.

Oleg_golOption: C

C. terraform fmt -check -recursive