main.tf

resource "aws_dynamodb_table" "nonproductive" {
name           ="${var.deployment_name}_nonprod"
billing_mode   = "PAY_PER_REQUEST"
read_capacity  = "${var.read_capacity}"
write_capacity = "${var.write_capacity}"
hash_key       = "metadataId"
range_key      = "source"
point_in_time_recovery = "${var.db_point_in_time_recovery}"
stream_enabled = "${var.stream_enabled}"
stream_view_type = "${var.stream_view_type}"
attribute {
name = "metadataId"
type = "S"
}
attribute {
name = "source"
type = "S"
}
lifecycle {
ignore_changes = ["read_capacity", "write_capacity"]  //capacities are ignored for autoscaling
}
tags = {
domain        ="${var.domain}"
cluster       ="${var.deployment_name}"
}}

вар.tf

variable "deployment_name" {
description="The name of the current deployment"
}
variable "db_point_in_time_recovery" {
description="Point of recovery preserves the data for 35days and can be recovery at any point of time during the cycle"
default = "true"
}
variable "stream_enabled" {
default = true
}
variable "stream_view_type" {
default = "NEW_IMAGE"
}
variable "domain"
{ 
description = "specify the domain name "
}