This repository has been archived on 2025-12-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tasker/tasker-server/terraform/dynamodb.tf
Andrew Trieu 11e61829f1 Wip backend (#4)
* feat: Add new API handlers for user, project, and task management; update package dependencies

* feat: Update .gitignore, add Lambda layer configuration, and refactor DynamoDB handlers to use AWS SDK v3

* feat: Update serverless configuration and refactor API handlers to improve error handling and response structure

* feat: Add Cognito user pool name parameter and update API handlers to include CORS headers

* feat: Update task and project ID formats, add populateSeedData function, and enhance user ID handling

* feat: Update image source paths to use S3 public URL for profile and task attachments
2024-11-23 18:17:00 +02:00

205 lines
4.3 KiB
HCL

resource "aws_dynamodb_table" "tasker_project_table" {
name = "tasker-project-table"
billing_mode = "PAY_PER_REQUEST"
hash_key = "category"
range_key = "projectId"
attribute {
name = "category"
type = "S"
}
attribute {
name = "projectId"
type = "S"
}
}
resource "aws_ssm_parameter" "tasker_project_table_name" {
name = "/tasker/dynamodb/project-table-name"
type = "String"
value = aws_dynamodb_table.tasker_project_table.name
}
resource "aws_ssm_parameter" "tasker_project_table_arn" {
name = "/tasker/dynamodb/project-table-arn"
type = "String"
value = aws_dynamodb_table.tasker_project_table.arn
}
resource "aws_dynamodb_table" "tasker_user_table" {
name = "tasker-user-table"
billing_mode = "PAY_PER_REQUEST"
hash_key = "category"
range_key = "cognitoId"
attribute {
name = "category"
type = "S"
}
attribute {
name = "cognitoId"
type = "S"
}
attribute {
name = "userId"
type = "S"
}
global_secondary_index {
name = "GSI-user-id"
hash_key = "category"
range_key = "userId"
projection_type = "ALL"
}
}
resource "aws_ssm_parameter" "tasker_user_table_name" {
name = "/tasker/dynamodb/user-table-name"
type = "String"
value = aws_dynamodb_table.tasker_user_table.name
}
resource "aws_ssm_parameter" "tasker_user_table_arn" {
name = "/tasker/dynamodb/user-table-arn"
type = "String"
value = aws_dynamodb_table.tasker_user_table.arn
}
resource "aws_dynamodb_table" "tasker_team_table" {
name = "tasker-team-table"
billing_mode = "PAY_PER_REQUEST"
hash_key = "category"
range_key = "teamId"
attribute {
name = "category"
type = "S"
}
attribute {
name = "teamId"
type = "S"
}
}
resource "aws_ssm_parameter" "tasker_team_table_name" {
name = "/tasker/dynamodb/team-table-name"
type = "String"
value = aws_dynamodb_table.tasker_team_table.name
}
resource "aws_ssm_parameter" "tasker_team_table_arn" {
name = "/tasker/dynamodb/team-table-arn"
type = "String"
value = aws_dynamodb_table.tasker_team_table.arn
}
resource "aws_dynamodb_table" "tasker_task_table" {
name = "tasker-task-table"
billing_mode = "PAY_PER_REQUEST"
hash_key = "category"
range_key = "taskId"
attribute {
name = "category"
type = "S"
}
attribute {
name = "taskId"
type = "S"
}
attribute {
name = "projectId"
type = "S"
}
attribute {
name = "authorUserId"
type = "S"
}
attribute {
name = "assignedUserId"
type = "S"
}
global_secondary_index {
name = "GSI-project-id"
hash_key = "category"
range_key = "projectId"
projection_type = "ALL"
}
global_secondary_index {
name = "GSI-author-user-id"
hash_key = "category"
range_key = "authorUserId"
projection_type = "ALL"
}
global_secondary_index {
name = "GSI-assigned-user-id"
hash_key = "category"
range_key = "assignedUserId"
projection_type = "ALL"
}
}
resource "aws_ssm_parameter" "tasker_task_table_name" {
name = "/tasker/dynamodb/task-table-name"
type = "String"
value = aws_dynamodb_table.tasker_task_table.name
}
resource "aws_ssm_parameter" "tasker_task_table_arn" {
name = "/tasker/dynamodb/task-table-arn"
type = "String"
value = aws_dynamodb_table.tasker_task_table.arn
}
resource "aws_dynamodb_table" "tasker_task_extra_table" {
name = "tasker-task-extra-table"
billing_mode = "PAY_PER_REQUEST"
hash_key = "category"
range_key = "id"
attribute {
name = "category"
type = "S"
}
attribute {
name = "id"
type = "S"
}
attribute {
name = "taskId"
type = "S"
}
global_secondary_index {
name = "GSI-task-id"
hash_key = "category"
range_key = "taskId"
projection_type = "ALL"
}
}
resource "aws_ssm_parameter" "tasker_task_extra_table_name" {
name = "/tasker/dynamodb/task-extra-table-name"
type = "String"
value = aws_dynamodb_table.tasker_task_extra_table.name
}
resource "aws_ssm_parameter" "tasker_task_extra_table_arn" {
name = "/tasker/dynamodb/task-extra-table-arn"
type = "String"
value = aws_dynamodb_table.tasker_task_extra_table.arn
}