~/codewithstu

// open_source

AWS DynamoDB

OpenTofu module for provisioning AWS DynamoDB tables with global secondary indexes, multi-region replication, point-in-time recovery, and KMS encryption

View on GitHub

Overview

This module creates a DynamoDB table with support for global secondary indexes, global tables (multi-region replication), TTL, point-in-time recovery, and server-side encryption. SDynamoDB change streams are enabled by default for change data capture.

Key Features

  • DynamoDB table with configurable hash and range keys
  • Global secondary index (GSI) support
  • Global tables with multi-region replication
  • Point-in-time recovery enabled by default
  • DynamoDB Streams enabled by default (NEW_AND_OLD_IMAGES)
  • TTL support with configurable attribute name
  • KMS encryption at rest
  • Deletion protection option
  • Custom attribute type mapping (String, Number, Binary)

Usage

module "dynamodb" {
  source = "git::https://github.com/Im5tu/opentofu-aws-dynamodb.git?ref=main"
 
  table_name = "my-table"
  hash_key   = "PK"
  range_key  = "SK"
}