Skip to content

rpstreef/tf-dynamodb

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Terraform AWS DynamoDB module

About:

AWS DynamoDB Terraform module that supports dynamic GSI's, LSI's, and table attributes.

Please note the ignore changes set by default to prevent change deployments to AWS, remove when needed:

lifecycle {
  ignore_changes = [
    read_capacity,
    write_capacity,
    global_secondary_index,
    local_secondary_index
  ]
}

How to use:

module "dynamodb" {
  source = "github.com/rpstreef/tf-dynamodb?ref=v1.0"

  resource_tag_name = var.resource_tag_name
  namespace         = var.namespace
  region            = var.region

  dynamodb_table_name = var.dynamodb_table_name
  hash_key            = var.dynamodb_hash_key
  range_key           = var.dynamodb_range_key

  attributes = [
    {
      name = var.dynamodb_hash_key
      type = "S"
    },
    {
      name = var.dynamodb_range_key
      type = "S"
    }
  ]

  global_secondary_index_map = [
    {
      name               = var.dynamodb_gsi_1_name
      hash_key           = var.dynamodb_gsi_1_hash_key
      range_key          = var.dynamodb_gsi_1_range_key
      projection_type    = var.dynamodb_gsi_1_projection_type
      write_capacity     = var.dynamodb_gsi_1_write_capacity
      read_capacity      = var.dynamodb_gsi_1_read_capacity
      non_key_attributes = null
    }
  ]
}

Changelog

v1.1

  • Added module on/off switch dynamodb_module_enabled
  • Added full dynamodb output object

v1.0

Initial release