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"
}
}
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"
}
}