Recall & Review
beginner
What is the Terraform state file?
The Terraform state file is a record that keeps track of the resources Terraform manages. It helps Terraform know what exists in your cloud and what needs to be changed.
Click to reveal answer
beginner
Why should you avoid editing the Terraform state file manually?
Editing the state file manually can cause Terraform to lose track of resources or create conflicts. This can lead to errors or unexpected changes when Terraform runs.
Click to reveal answer
intermediate
What can happen if the Terraform state file is corrupted?
If the state file is corrupted, Terraform may not know the real status of your resources. This can cause Terraform to try to recreate or delete resources incorrectly.
Click to reveal answer
intermediate
How does Terraform use the state file during apply?
Terraform compares the current state file with your configuration to decide what changes to make. If the state file is wrong, Terraform's decisions will be wrong too.
Click to reveal answer
advanced
What is a safe way to fix issues in Terraform state?
Use Terraform commands like 'terraform state rm' or 'terraform state mv' to safely update the state. These commands keep the state consistent and avoid manual errors.
Click to reveal answer
What is the main purpose of the Terraform state file?
✗ Incorrect
The state file records the resources Terraform manages so it can track changes.
What is a risk of manually editing the Terraform state file?
✗ Incorrect
Manual edits can confuse Terraform, causing it to lose track of resources.
Which command is safe to use for modifying Terraform state?
✗ Incorrect
'terraform state mv' safely moves resources in the state without manual file edits.
If the state file is corrupted, what might happen?
✗ Incorrect
A corrupted state file can cause Terraform to make wrong changes to resources.
Why does Terraform compare the state file with configuration during apply?
✗ Incorrect
Terraform uses the state file to know what exists and what needs updating.
Explain why manually editing the Terraform state file is discouraged.
Think about how Terraform uses the state file to manage resources.
You got /4 concepts.
Describe how Terraform uses the state file during an apply operation.
Consider the role of the state file as Terraform's memory.
You got /3 concepts.