Terraform state locking is really important when you work in a team where multiple developers are trying to update the same Terraform state file.
It prevents Terraform state file(terraform.tfstate) from accidental updates by putting a lock on the file so that the current update can be finished before processing the new change. The feature of Terraform state locking is supported by AWS S3 and Dynamo DB(LockID).
In this lab session, we will be looking into -
- How to Store Terraform state file remotely on S3?
- Create DynamoDB table with LockID as Key
- Simulate the terraform state locking by creating multiple terraform projects using the same Terraform state file.