0
0
Terraformcloud~10 mins

Why state operations are needed in Terraform - Test Your Understanding

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

Complete the code to initialize Terraform state.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Aapply
Bplan
Cinit
Ddestroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' before initializing state.
Confusing 'plan' with initialization.
2fill in blank
medium

Complete the code to show the current Terraform state.

Terraform
terraform [1] show
Drag options to blanks, or click blank then click option'
Aoutput
Bstate
Crefresh
Dvalidate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'output' which shows output variables, not state.
Using 'refresh' which updates state but does not show it.
3fill in blank
hard

Fix the error in the command to remove a resource from state.

Terraform
terraform state [1] aws_instance.example
Drag options to blanks, or click blank then click option'
Arm
Bdelete
Cremove
Ddestroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' which is not a valid subcommand.
Using 'destroy' which deletes actual resources, not state entries.
4fill in blank
hard

Fill the blank to correctly move a resource in Terraform state.

Terraform
terraform state [1] aws_instance.old_name aws_instance.new_name
Drag options to blanks, or click blank then click option'
Amv
Brm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rm' which removes resources instead of moving.
Using 'destroy' which deletes actual resources, not state entries.
5fill in blank
hard

Fill both blanks to correctly import an existing resource into Terraform state.

Terraform
terraform import [1] [2]
Drag options to blanks, or click blank then click option'
Aaws_instance.example
Bi-1234567890abcdef0
C-config=terraform.tf
D-var-file=prod.tfvars
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-config=terraform.tf' instead of resource address.
Mixing resource ID and address positions.