Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions terraform/modules/dynamo/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,56 @@ resource "aws_dynamodb_table" "store_inventory" {
type = "S"
}
}

resource "aws_dynamodb_table" "store_carts_orders" {
billing_mode = "PAY_PER_REQUEST"
name = "${var.ProjectId}-store-carts-orders"
deletion_protection_enabled = true
hash_key = "orderId"
range_key = "lineItemId"
point_in_time_recovery {
enabled = true
}
attribute {
name = "orderId"
type = "S"
}
attribute {
name = "lineItemId"
type = "S"
}
attribute {
name = "itemId"
type = "S"
}

attribute {
name = "createdAt"
type = "S"
}
global_secondary_index {
name = "ItemIdIndex"
hash_key = "itemId"
range_key = "createdAt"
projection_type = "ALL"
}
}

resource "aws_dynamodb_table" "store_limits" {
billing_mode = "PAY_PER_REQUEST"
name = "${var.ProjectId}-store-limits"
deletion_protection_enabled = true
hash_key = "userId"
range_key = "limitId"
point_in_time_recovery {
enabled = true
}
attribute {
name = "userId"
type = "S"
}
attribute {
name = "limitId"
type = "S"
}
}
7 changes: 7 additions & 0 deletions terraform/modules/lambdas/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ resource "aws_iam_policy" "shared_iam_policy" {
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-keys",
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-sigs",
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-sigs/index/*",

// added permissions for 3 new tables
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-store-inventory",
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-store-carts-orders",
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-store-carts-orders/index/*",
"arn:aws:dynamodb:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:table/infra-core-api-store-limits"
]
},
{
Expand Down Expand Up @@ -459,3 +465,4 @@ output "core_sqs_consumer_lambda_name" {
value = local.core_sqs_consumer_lambda_name
}


Loading