How to Create a DynamoDB Lock Table for Terraform

Provision the DynamoDB Table

resource "aws_dynamodb_table" "dynamodb-terraform-state-lock" { name = "terraform-state-lock-dynamo" hash_key = "LockID" read_capacity = 20 write_capacity = 20 attribute { name = "LockID" type = "S" } }
Code language: plaintext (plaintext)

Configure the DynamoDB table in Terraform Backend

terraform { backend "s3" { encrypt = true bucket = "your-unique-bucket-name" dynamodb_table = "terraform-state-lock-dynamo" key = "terraform.tfstate" region = "us-east-1" } }
Code language: plaintext (plaintext)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments