DEV Community

Rahul Wagh
Rahul Wagh

Posted on

3

Terraform state locking using DynamoDB(LockID) and S3 Bucket

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 -

  1. How to Store Terraform state file remotely on S3?
  2. Create DynamoDB table with LockID as Key
  3. Simulate the terraform state locking by creating multiple terraform projects using the same Terraform state file.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay