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 35 discussion

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

You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

  • A. Run the terraform fmt command during the code linting phase of your CI/CD process
  • B. Designate one person in each team to review and format everyone's code
  • C. Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
  • D. Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
✑ Indent two spaces for each nesting level.
✑ When multiple arguments with single-line values appear on consecutive lines at the same nesting level, align their equals signs.
Reference:
https://www.terraform.io/docs/language/syntax/style.html

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
vitasac
Highly Voted 2 years ago
Selected Answer: A
Yes Answer A
upvoted 33 times
...
calebvar
Highly Voted 2 years ago
correct answer is A
upvoted 11 times
...
nickyop
Most Recent 1 month, 4 weeks ago
Okay, as obvious as the option A is the correct answer, here's one question. What happens if such questions arise in the terraform exam where they have the wrong answers saved as the right ones? For example, in the above question, if we choose the most voted option in the exam, we'll lose 1 mark just because the right answer is C according to the system?? And FYI, I have already undergone one attempt for the exam which I was certain that I would pass because it went pretty well but I failed by 2%. And I know for sure it is only because of such contradictory questions! @Hashicorp please settle such questions once and for all!
upvoted 2 times
AkaAka4
1 week, 6 days ago
Why are you even tagging Hashicorp here... do you think they will see your comment😂
upvoted 1 times
...
...
ghostGuiggs
6 months ago
Selected Answer: A
A is the answer
upvoted 2 times
...
Tyler2023
6 months, 2 weeks ago
The answer C is correct You can manually format your TF configuration to follow the Style Conventions Option A doesn't make any sense, why you run the terraform fmt in CI/CI process? that will only format the copy of the configuration in the remote agent that is running your configuration files, it doesn't modify your source codes in version control system. Option C followed the Terraform style convention, but it only do it manually https://developer.hashicorp.com/terraform/language/syntax/style
upvoted 1 times
nickyop
1 month, 4 weeks ago
Referring the link you have shared, I think you missed a note where they have mentioned "You can enforce these conventions automatically by running terraform fmt."
upvoted 2 times
...
Clapton79
5 months, 4 weeks ago
Pull Request is a CI/CD process and it can format code and it does modify your version control.
upvoted 1 times
...
...
gofavad926
7 months, 1 week ago
Selected Answer: A
A for sure
upvoted 1 times
...
vc1011
9 months, 3 weeks ago
Selected Answer: A
ITs very evident A
upvoted 1 times
...
Awadh
10 months ago
A is the correct answer, who is writing the answers
upvoted 4 times
...
Shane_C
10 months, 1 week ago
Selected Answer: A
Now they have to be joking. The only reasonable answer is A. Everything else is just nonsense
upvoted 3 times
nickyop
1 month, 4 weeks ago
Yes, thank you!
upvoted 1 times
...
...
Ni33
12 months ago
Selected Answer: A
A is correct
upvoted 1 times
...
Ni33
1 year ago
Selected Answer: A
A is the correct answer
upvoted 1 times
...
Bluemoon22
1 year ago
A, by using terraform fmt command
upvoted 1 times
...
connecttozee
1 year, 1 month ago
A is correct
upvoted 1 times
...
camps
1 year, 1 month ago
Selected Answer: A
A. Run the terraform fmt command during the code linting phase of your CI/CD process. Terraform provides a command called terraform fmt that can be used to automatically format Terraform HCL code according to the standard Terraform style convention. Running this command on your codebase during the code linting phase of your CI/CD process can ensure that your code is formatted consistently across your team and conforms to the standard Terraform style convention.
upvoted 6 times
...
Power123
1 year, 1 month ago
A is correct
upvoted 1 times
...
hasanuckun
1 year, 1 month ago
answer is a
upvoted 1 times
...
alexsandroe
1 year, 2 months ago
Selected Answer: A
FMT helped de code
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 ...