Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize Terraform state.
Terraform
terraform [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'apply' before initializing state.
Confusing 'plan' with initialization.
✗ Incorrect
Terraform uses init to initialize the working directory and state backend.
2fill in blank
mediumComplete the code to show the current Terraform state.
Terraform
terraform [1] show Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'output' which shows output variables, not state.
Using 'refresh' which updates state but does not show it.
✗ Incorrect
The state show command displays detailed information about resources in the state.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' which is not a valid subcommand.
Using 'destroy' which deletes actual resources, not state entries.
✗ Incorrect
The correct command to remove a resource from state is terraform state rm.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'rm' which removes resources instead of moving.
Using 'destroy' which deletes actual resources, not state entries.
✗ Incorrect
The terraform state mv command moves a resource in the state file from one name to another.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-config=terraform.tf' instead of resource address.
Mixing resource ID and address positions.
✗ Incorrect
The terraform import command requires the resource address and the real resource ID.