resource "aws_dynamodb_table" "lambda_table" { name = var.table_name billing_mode = var.billing_mode hash_key = var.hash_key range_key = var.range_key attribute { name = var.hash_key type = var.hash_key_type } attribute { name = var.range_key type = "N" } attribute { name = "data" type = "S" } attribute { name = "timestampIndex" type = var.sort_key_type } global_secondary_index { name = "data-index" hash_key = "data" projection_type = "ALL" read_capacity = var.read_capacity_units write_capacity = var.write_capacity_units non_key_attributes = [] } global_secondary_index { name = "id-index" hash_key = "id" projection_type = "ALL" read_capacity = var.read_capacity_units write_capacity = var.write_capacity_units non_key_attributes = [] } global_secondary_index { name = "timestamp-index" hash_key = "timestampIndex" range_key = var.range_key read_capacity = var.read_capacity_units write_capacity = var.write_capacity_units projection_type = "INCLUDE" non_key_attributes = ["id", "data"] } } output "name" { value = aws_dynamodb_table.lambda_table.name } output "arn" { value = aws_dynamodb_table.lambda_table.arn } output "stream_arn" { value = aws_dynamodb_table.lambda_table.stream_arn }