Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam Terraform Associate topic 1 question 172 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 172
Topic #: 1
[All Terraform Associate Questions]

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

  • A. True
  • B. False
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Burakko
Highly Voted 1 year, 8 months ago
Selected Answer: B
The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style.
upvoted 15 times
...
ARBAR
Most Recent 2 weeks, 1 day ago
Selected Answer: 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.
upvoted 1 times
...
Bere
3 months, 1 week ago
Selected Answer: 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.
upvoted 3 times
...
Albion
5 months ago
Selected Answer: B
Tested. The terraform fmt command, format files content. No need for any flag
upvoted 1 times
...
diegoa
5 months ago
Selected Answer: 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
upvoted 2 times
...
Ramdi1
5 months, 2 weeks ago
Selected Answer: 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
upvoted 1 times
...
LemonadeSoftware
5 months, 3 weeks ago
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
upvoted 2 times
...
arun00028
6 months, 3 weeks ago
Option A
upvoted 1 times
...
VSMu
9 months, 3 weeks ago
Selected Answer: B
Tested. The answer is B. Running terraform fmt updates (formats) the .tf files in the current working directory.
upvoted 1 times
...
SimoAz
9 months, 3 weeks ago
Selected Answer: A
default write value is false donc A is correct
upvoted 2 times
...
tycho
1 year ago
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
upvoted 1 times
...
BennaniHaythem
1 year ago
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.
upvoted 3 times
...
Stanislav4907
1 year ago
Selected Answer: 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.
upvoted 2 times
...
Nunyabiznes
1 year, 1 month ago
Selected Answer: B
If you want to check the formatting without modifying the files, you can use the -check flag: terraform fmt -check
upvoted 2 times
...
princajen
1 year, 2 months ago
Selected Answer: 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.
upvoted 1 times
David_C_90
1 year, 1 month ago
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
upvoted 2 times
...
...
InformationOverload
1 year, 4 months ago
Selected Answer: B
Tested in lab, B is correct.
upvoted 3 times
...
sameed
1 year, 5 months ago
Selected Answer: B
It will not only check the content but reformat it if required.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...