0
0
Terraformcloud~10 mins

Terraform fmt for formatting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to format Terraform files using the correct command.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Aapply
Binit
Cplan
Dfmt
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' instead of 'fmt' which runs changes instead of formatting.
Using 'init' which initializes Terraform but does not format files.
2fill in blank
medium

Complete the command to format Terraform files recursively in all subdirectories.

Terraform
terraform fmt [1]
Drag options to blanks, or click blank then click option'
A-list
B-recursive
C-check
D-diff
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-list' which only lists files that would be formatted.
Using '-check' which only checks formatting without changing files.
3fill in blank
hard

Fix the error in the command to check formatting without changing files.

Terraform
terraform fmt [1]
Drag options to blanks, or click blank then click option'
A-check
B-diff
C-write=true
D-recursive
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-write=true' which actually writes changes to files.
Using '-diff' which shows differences but does not check status.
4fill in blank
hard

Fill both blanks to format files and show differences without writing changes.

Terraform
terraform fmt [1] [2]
Drag options to blanks, or click blank then click option'
A-diff
B-recursive
C-check
D-write=false
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-check' instead of '-diff' which only checks formatting.
Omitting '-recursive' which limits formatting to current folder.
5fill in blank
hard

Fill all three blanks to check formatting recursively and prevent writing changes.

Terraform
terraform fmt [1] [2] [3]
Drag options to blanks, or click blank then click option'
A-recursive
B-check
C-write=false
D-diff
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-write=true' which would modify files.
Omitting '-recursive' which skips subfolders.