0
0
Terraformcloud~10 mins

Local state behavior 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 local state.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Aplan
Binit
Capply
Ddestroy
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 local state.

Terraform
terraform [1]
Drag options to blanks, or click blank then click option'
Ashow
Bapply
Cstate
Drefresh
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'state' requires a subcommand like 'list' or 'show' to view details.
Using 'refresh' updates state but doesn't display it.
3fill in blank
hard

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

Terraform
terraform state [1] aws_instance.example
Drag options to blanks, or click blank then click option'
Alist
Bshow
Cmv
Drm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' only shows resources.
Using 'mv' moves resources but does not remove them.
4fill in blank
hard

Fill both blanks to correctly output the Terraform state list filtered by resource type.

Terraform
terraform state [1] | grep [2]
Drag options to blanks, or click blank then click option'
Alist
Brm
Caws_instance
Dmv
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rm' instead of 'list' will remove resources.
Filtering with wrong resource type shows no results.
5fill in blank
hard

Fill all three blanks to correctly move a resource in local state to a new name.

Terraform
terraform state [1] [2] [3]
Drag options to blanks, or click blank then click option'
Amv
Baws_instance.old_name
Caws_instance.new_name
Drm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rm' deletes the resource instead of renaming.
Swapping old and new names causes errors.