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

Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files without changing their contents.

    Correct Answer: B

    Running terraform fmt without any flags will automatically rewrite Terraform configuration files to adhere to a canonical format and style. This means it will modify the files to ensure they are correctly formatted according to Terraform's standards. It does not simply check the formatting; it actively changes the files if they are not formatted correctly.

Discussion
BurakkoOption: B

The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style.

BereOption: B

Running terraform fmt without any flags in a directory with Terraform configuration files will not only check the formatting of those files but will also rewrite them to a canonical format if they are not already formatted correctly. If you want to check the formatting without making any changes, you should use the -check flag with the command. This flag will instruct Terraform to check if the input is formatted correctly and return a non-zero exit code if it isn't, without modifying the files.

BennaniHaythemOption: A

True. Running terraform fmt without any flags will check the formatting of the Terraform configuration files in the current directory, and it will update the files to conform to the standard formatting rules defined by Terraform. However, it will not change the contents of the files. If you want to modify the contents of the files to match the formatting rules, you can run terraform fmt -write=true.

InformationOverloadOption: B

Tested in lab, B is correct.

diegoaOption: A

If no flag is given, fmt rewrites the Terraform configuration files to a canonical format and style.https://developer.hashicorp.com/terraform/cli/commands/fmt

LemonadeSoftwareOption: A

A 100% Running terraform fmt without any flags in a directory with Terraform configuration files checks the formatting without altering the content because the command is used to format and standardize the layout of Terraform configuration files according to the defined conventions. When executed without any flags, it checks whether the files comply with the expected formatting standards but does not modify the content unless there's a need for formatting changes to align with the defined conventions. If you want to format it, you have to add the “-w” flag

SimoAzOption: A

default write value is false donc A is correct

Stanislav4907Option: A

Yes, that's correct. Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files without changing their contents. terraform fmt is a command that formats your Terraform configuration files according to a set of standard conventions. This makes your code more readable, easier to maintain, and more consistent with best practices.

NunyabiznesOption: B

If you want to check the formatting without modifying the files, you can use the -check flag: terraform fmt -check

ARBAROption: A

Running terraform fmt without any flags in a directory with Terraform configuration files will indeed check the formatting of those files without changing their contents. It will only modify the formatting to comply with Terraform's style conventions if necessary, without altering the actual content of the files.

AlbionOption: B

Tested. The terraform fmt command, format files content. No need for any flag

Ramdi1Option: A

just read the document, it says if you use it without a flag or directory it will not process anything. however if you add a flag it will process it

arun00028Option: A

Option A

VSMuOption: B

Tested. The answer is B. Running terraform fmt updates (formats) the .tf files in the current working directory.

tychoOption: B

apparently according to this question the changing of the format is a change in the file content, therefore answer is B ; somehow it wants to highlight the diff between -check option and without it

princajenOption: A

A. True. Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files without changing their contents. The command will print a list of files that need formatting changes, but it will not actually make any changes to the files. This can be useful for checking if files have been manually edited or if they need to be updated to conform to a new format. If you want to apply the formatting changes to the files, you can use the -write flag or the -check flag to check and write the formatting changes at the same time.

David_C_90

This is wrong. $ terraform fmt -h Rewrites all Terraform configuration files to a canonical format. (...) --- If you want to check without changing the files, use -write=false or -check

sameedOption: B

It will not only check the content but reformat it if required.