0
0
Terraformcloud~10 mins

State and real infrastructure mapping in Terraform - Interactive Code Practice

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

Complete the code to initialize Terraform state in the current directory.

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

Complete the code to show the current Terraform state.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Ashow
Bstate list
Crefresh
Dapply
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'state list' only lists resource addresses, not full state details.
Using 'apply' changes infrastructure instead of showing state.
3fill in blank
hard

Fix the error in the command to refresh Terraform state with real infrastructure.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Aplan
Bapply
Crefresh
Ddestroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' changes infrastructure instead of just refreshing state.
Using 'plan' only shows changes but does not update state.
4fill in blank
hard

Fill both blanks to list all resources in the Terraform state and filter by resource type.

Terraform
terraform state [1] | grep [2]
Drag options to blanks, or click blank then click option'
Alist
Bshow
Caws_instance
Dplan
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' instead of 'list' does not list resource addresses.
Using 'plan' is unrelated to state listing.
5fill in blank
hard

Fill the blanks to remove a resource from Terraform state safely.

Terraform
terraform state [1] [2]
Drag options to blanks, or click blank then click option'
Arm
Baws_instance.example
C-force
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'show' instead of 'rm' does not remove resources.
Confusing state 'rm' with 'destroy', which affects real infrastructure.