resource "aws_dynamodb_table" "users" { name = "${var.project_name}-users" billing_mode = "PAY_PER_REQUEST" hash_key = "user_id" attribute { name = "user_id" type = "S" } attribute { name = "guild_id" type = "S" } global_secondary_index { name = "GuildIndex" hash_key = "guild_id" projection_type = "ALL" } point_in_time_recovery { enabled = true } server_side_encryption { enabled = true } tags = { Name = "${var.project_name}-users" } } resource "aws_dynamodb_table" "conversations" { name = "${var.project_name}-conversations" billing_mode = "PAY_PER_REQUEST" hash_key = "conversation_id" attribute { name = "conversation_id" type = "S" } attribute { name = "user_id" type = "S" } attribute { name = "created_at" type = "S" } global_secondary_index { name = "UserIndex" hash_key = "user_id" range_key = "created_at" projection_type = "ALL" } point_in_time_recovery { enabled = true } server_side_encryption { enabled = true } tags = { Name = "${var.project_name}-conversations" } }