Recall & Review
beginner
What does the
terraform state list command do?It shows all the resources currently tracked in the Terraform state file. Think of it like a list of all items Terraform knows about in your infrastructure.
Click to reveal answer
beginner
Why is the Terraform state important?
The state keeps track of what Terraform has created or changed. It helps Terraform know what to update or delete next time you run it.
Click to reveal answer
intermediate
How can you use
terraform state list to find a specific resource?You can add a filter after the command, like
terraform state list aws_instance.myserver, to see if that resource exists in the state.Click to reveal answer
intermediate
What happens if the Terraform state file is missing or corrupted?
Terraform won’t know what resources it manages, which can cause errors or duplicate resources. Always keep backups of your state file.
Click to reveal answer
intermediate
Can
terraform state list show resources from multiple workspaces?No, it only shows resources from the current workspace’s state. You need to switch workspaces to see their states.
Click to reveal answer
What does
terraform state list display?✗ Incorrect
terraform state list shows all resources Terraform currently tracks in the state file.
How can you filter the output of
terraform state list?✗ Incorrect
You can add a resource name or type after terraform state list to filter results.
If the state file is missing, what will happen when you run Terraform?
✗ Incorrect
Terraform relies on the state file. If missing, it will error out to avoid mistakes.
Does
terraform state list show resources from all workspaces at once?✗ Incorrect
The command shows resources only from the workspace you are currently using.
Why should you keep backups of your Terraform state file?
✗ Incorrect
Backups protect your state data so Terraform can manage resources correctly.
Explain what the
terraform state list command does and why it is useful.Think about how Terraform keeps track of what it manages.
You got /3 concepts.
Describe what could happen if the Terraform state file is lost or corrupted.
Consider Terraform’s need to know what it already created.
You got /3 concepts.