Saturday, September 30, 2023
HomeSoftware EngineeringHow you can Create a DynamoDB Lock Desk for Terraform

How you can Create a DynamoDB Lock Desk for Terraform


Provision the DynamoDB Desk

useful resource "aws_dynamodb_table" "dynamodb-terraform-state-lock" {
  identify = "terraform-state-lock-dynamo"
  hash_key = "LockID"
  read_capacity = 20
  write_capacity = 20
 
  attribute {
    identify = "LockID"
    sort = "S"
  }
}

Configure the DynamoDB desk in Terraform Backend

terraform {
  backend "s3" {
    encrypt = true
    bucket = "your-unique-bucket-name"
    dynamodb_table = "terraform-state-lock-dynamo"
    key    = "terraform.tfstate"
    area = "us-east-1"
  }
}
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments