Problem Statement
Explain Terraform state locking and why it is important in team environments.
Explanation
Terraform state locking prevents multiple users or processes from modifying the same state file simultaneously.
When a user runs a command that modifies infrastructure, Terraform locks the state file to avoid concurrent writes. Without locking, two users could apply conflicting changes, leading to corrupted state and unpredictable results. Remote backends like AWS S3 with DynamoDB or Terraform Cloud provide automatic state locking for safety in multi-user teams.
