Recall & Review
beginner
What is the purpose of the local state file in Terraform?
The local state file keeps track of the resources Terraform manages. It helps Terraform know what exists so it can update or delete resources correctly.
Click to reveal answer
beginner
Where is the Terraform local state file usually stored?
By default, the local state file is stored in the same folder as your Terraform configuration files, named
terraform.tfstate.Click to reveal answer
intermediate
What happens if the local state file is deleted or lost?
Terraform loses track of the resources it manages. It may try to recreate resources or fail to update existing ones, causing inconsistencies.
Click to reveal answer
intermediate
How can you protect your Terraform local state file from being lost or corrupted?
You can back it up regularly or use remote state storage like Terraform Cloud or S3 to keep the state safe and share it among team members.
Click to reveal answer
intermediate
Why is local state not recommended for team environments?
Because local state is stored on one machine, it can cause conflicts if multiple people change infrastructure at the same time. Remote state helps avoid this.
Click to reveal answer
What file does Terraform use by default to store local state?
✗ Incorrect
Terraform stores the local state in a file named terraform.tfstate by default.
What is a risk of using local state in Terraform?
✗ Incorrect
Local state files can be lost or corrupted, causing Terraform to lose track of managed resources.
Why might teams prefer remote state over local state?
✗ Incorrect
Remote state allows multiple users to share and lock the state file, preventing conflicts.
If you delete the local state file, what will Terraform do on next apply?
✗ Incorrect
Without the state file, Terraform thinks no resources exist and tries to create them again.
Where is the local state file stored by default?
✗ Incorrect
By default, Terraform stores the local state file in the folder where you run Terraform.
Explain what the Terraform local state file is and why it is important.
Think about how Terraform remembers what it created.
You got /4 concepts.
Describe the risks of using local state in a team and how to mitigate them.
Consider what happens when multiple people work on the same infrastructure.
You got /4 concepts.