5 exercises on Terraform state management vocabulary.
0 / 5 completed
1 / 5
What is the Terraform state file?
State file:terraform.tfstate records what Terraform has created and their IDs. Without it, Terraform cannot determine what already exists, preventing it from planning correct updates or destroys.
2 / 5
Why should Terraform state be stored in a remote backend for teams?
Remote backend: backends like S3+DynamoDB or Terraform Cloud store state centrally and implement locking. Without them, concurrent applies can merge corrupted states, leading to resource drift or duplicates.
3 / 5
What does state locking prevent?
State locking: before writing, Terraform acquires a lock (DynamoDB item or Terraform Cloud mutex). If a lock exists, the second apply aborts. This serializes changes and keeps state consistent in team environments.
4 / 5
What is terraform state mv used for?
state mv: when you refactor configuration (rename a resource or move it into a module), state mv updates the state mapping so Terraform knows the existing resource corresponds to the new address, avoiding recreation.
5 / 5
What risk does sensitive data in state pose?
Sensitive state: Terraform stores all attributes including secrets. Remote backends should use server-side encryption (S3 SSE, Terraform Cloud encryption). Access to state should be restricted like access to production secrets.