0
0
Terraformcloud~5 mins

Comments in HCL in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What symbol is used for a single-line comment in HCL?
The # or // symbols are used for single-line comments in HCL.
Click to reveal answer
beginner
How do you write a multi-line comment in HCL?
Use /* to start and */ to end a multi-line comment in HCL.
Click to reveal answer
beginner
Why are comments useful in Terraform configuration files?
Comments help explain the purpose of code, making it easier to understand and maintain.
Click to reveal answer
beginner
Can comments affect the behavior of Terraform configurations?
No, comments are ignored by Terraform and do not affect configuration behavior.
Click to reveal answer
beginner
Show an example of a single-line and a multi-line comment in HCL.
Single-line comment: # This is a comment or // This is a comment<br>Multi-line comment:<br>/*<br>This is a<br>multi-line comment<br>*/
Click to reveal answer
Which of the following is NOT a valid way to write a comment in HCL?
A<!-- This is a comment -->
B# This is a comment
C// This is a comment
D/* This is a comment */
What happens to comments when Terraform processes a configuration file?
AThey are executed as code
BThey are converted to variables
CThey are ignored
DThey cause errors
Which symbols can start a single-line comment in HCL?
A# and //
B/* and */
C<!-- and -->
D-- and ##
How do you write a multi-line comment in HCL?
AUse <code>--</code> at the start and end
BStart with <code>#</code> on each line
CUse <code>//</code> on each line
DEnclose text between <code>/*</code> and <code>*/</code>
Why should you use comments in your Terraform files?
ATo make the code run faster
BTo explain code for better understanding
CTo hide code from Terraform
DTo create variables
Explain how to write single-line and multi-line comments in HCL and why they are important.
Think about how you add notes in a text to help yourself or others understand it later.
You got /4 concepts.
    Describe the impact of comments on Terraform configuration behavior.
    Consider if Terraform treats comments like code or just skips them.
    You got /3 concepts.