Skip to content

schubergphilis/terraform-aws-mcaf-dynamodb

Repository files navigation

terraform-aws-mcaf-dynamodb

Terraform module to create an AWS DynamoDB Table.

IMPORTANT: We do not pin modules to versions in our examples. We highly recommend that in your code you pin the version to the exact version you are using so that your infrastructure remains stable.

Requirements

Name Version
terraform >= 1.3
aws >= 4.52.0

Providers

Name Version
aws >= 4.52.0

Modules

No modules.

Resources

Name Type
aws_dynamodb_contributor_insights.table_insight resource
aws_dynamodb_table.table resource

Inputs

Name Description Type Default Required
attributes List of nested attribute definitions. Only required for hash_key and range_key attributes. Each attribute has two properties: name - (Required) The name of the attribute, type - (Required) Attribute type, which must be a scalar type: S, N, or B for (S)tring, (N)umber or (B)inary data. list(map(string)) n/a yes
hash_key The attribute to use as the hash (partition) key. Must also be defined as an attribute string n/a yes
kms_key_arn The ARN of the KMS key to use; if set to null the aws/dynamodb AWS-managed key will be used string n/a yes
name Name of the DynamoDB table string n/a yes
billing_mode Controls how you are billed for read/write throughput and how you manage capacity. The valid values are PROVISIONED or PAY_PER_REQUEST. string "PAY_PER_REQUEST" no
deletion_protection_enabled Enables deletion protection for the table. bool true no
enable_dynamodb_insights Set to true to enable CloudWatch contributor insights for DynamoDB bool false no
global_secondary_indexes Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc.
list(object({
name = string
hash_key = string
projection_type = string
range_key = optional(string, null)
read_capacity = optional(string, null)
write_capacity = optional(string, null)
non_key_attributes = optional(list(string), null)
}))
[] no
local_secondary_indexes Describe a LSI on the table; these can only be allocated at creation so you cannot change this definition after you have created the resource.
list(object({
name = string
range_key = string
projection_type = string
non_key_attributes = optional(list(string), null)
}))
[] no
point_in_time_recovery_enabled Set to true to enable point-in-time recovery bool true no
range_key The attribute to use as the range (sort) key. Must also be defined as an attribute string null no
read_capacity The number of read units for this table. If the billing_mode is PROVISIONED, this field should be greater than 0 number null no
replica_regions Region names for creating replicas for a global DynamoDB table including parameters.
list(object({
region_name = string
kms_key_arn = optional(string, null)
propagate_tags = optional(bool, null)
point_in_time_recovery = optional(bool, null)
}))
[] no
stream_enabled Set to true to enable streams bool false no
stream_view_type When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES. string null no
table_class The storage class of the table. Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS string null no
tags A map of tags to add to all resources map(string) {} no
ttl_attribute_name The name of the table attribute to store the TTL timestamp in string "" no
ttl_enabled Indicates whether ttl is enabled bool false no
write_capacity The number of write units for this table. If the billing_mode is PROVISIONED, this field should be greater than 0 number null no

Outputs

Name Description
arn ARN of the DynamoDB table
id ID of the DynamoDB table

Licensing

100% Open Source and licensed under the Apache License Version 2.0. See LICENSE for full details.