File tree Expand file tree Collapse file tree
infrastructure/terraform/components/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ resource "aws_dynamodb_table" "supplier-quotas" {
2+ name = " ${ local . csi } -supplier-quotas"
3+ billing_mode = " PAY_PER_REQUEST"
4+
5+ hash_key = " pk"
6+ range_key = " sk"
7+
8+ ttl {
9+ attribute_name = " ttl"
10+ enabled = true
11+ }
12+
13+ attribute {
14+ name = " pk"
15+ type = " S"
16+ }
17+
18+ attribute {
19+ name = " sk"
20+ type = " S"
21+ }
22+
23+ attribute {
24+ name = " entityType"
25+ type = " S"
26+ }
27+
28+
29+
30+ // The type-index GSI allows us to query for all supplier quotas of a given type (e.g. all supplier daily quotas)
31+ global_secondary_index {
32+ name = " EntityTypeIndex"
33+ hash_key = " entityType"
34+ range_key = " sk"
35+ projection_type = " ALL"
36+ }
37+
38+ point_in_time_recovery {
39+ enabled = true
40+ }
41+
42+ tags = merge (
43+ local. default_tags ,
44+ {
45+ NHSE-Enable-Dynamo-Backup-Acct = " True"
46+ }
47+ )
48+
49+ }
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ locals {
3333 MI_TABLE_NAME = aws_dynamodb_table.mi.name,
3434 MI_TTL_HOURS = 2160 # 90 days * 24 hours
3535 SNS_TOPIC_ARN = " ${ module . eventsub . sns_topic . arn } " ,
36- SUPPLIER_CONFIG_TABLE_NAME = aws_dynamodb_table.supplier- configuration.name
36+ SUPPLIER_CONFIG_TABLE_NAME = aws_dynamodb_table.supplier- configuration.name,
37+ SUPPLIER_QUOTAS_TABLE_NAME = aws_dynamodb_table.supplier- quotas.name,
3738 SUPPLIER_ID_HEADER = " nhsd-supplier-id" ,
3839 }
3940
Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ data "aws_iam_policy_document" "supplier_allocator_lambda" {
9494
9595 resources = [
9696 aws_dynamodb_table . supplier-configuration . arn ,
97- " ${ aws_dynamodb_table . supplier-configuration . arn } /index/*"
97+ aws_dynamodb_table . supplier-quotas . arn ,
98+ " ${ aws_dynamodb_table . supplier-configuration . arn } /index/*" ,
99+ " ${ aws_dynamodb_table . supplier-quotas . arn } /index/*"
98100 ]
99101 }
100102}
You can’t perform that action at this time.
0 commit comments