Skip to content

Commit 5731336

Browse files
committed
Merge branch 'PRMP-1587' into PRMP-1601
2 parents ec30363 + 1d3fcc9 commit 5731336

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

infrastructure/dynamo_db.tf

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,61 @@ module "statistics_dynamodb_table" {
345345
}
346346
]
347347

348+
environment = var.environment
349+
owner = var.owner
350+
}
351+
352+
module "access_audit_dynamodb_table" {
353+
source = "./modules/dynamo_db"
354+
table_name = var.access_audit_dynamodb_table_name
355+
hash_key = "Type"
356+
sort_key = "ID"
357+
deletion_protection_enabled = local.is_production
358+
stream_enabled = false
359+
ttl_enabled = false
360+
point_in_time_recovery_enabled = !local.is_sandbox
361+
362+
attributes = [
363+
{
364+
name = "Type"
365+
type = "S"
366+
},
367+
{
368+
name = "ID"
369+
type = "S"
370+
},
371+
{
372+
name = "UserSessionID"
373+
type = "S"
374+
},
375+
{
376+
name = "UserID"
377+
type = "S"
378+
},
379+
{
380+
name = "UserOdsCode"
381+
type = "S"
382+
}
383+
]
384+
385+
global_secondary_indexes = [
386+
{
387+
name = "UserSessionIDIndex"
388+
hash_key = "UserSessionID"
389+
projection_type = "ALL"
390+
},
391+
{
392+
name = "UserIDIndex"
393+
hash_key = "UserID"
394+
projection_type = "ALL"
395+
},
396+
{
397+
name = "UserOdsCodeIndex"
398+
hash_key = "UserOdsCode"
399+
projection_type = "ALL"
400+
}
401+
]
402+
348403
environment = var.environment
349404
owner = var.owner
350405
}

infrastructure/modules/dynamo_db/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,18 @@ data "aws_iam_policy_document" "dynamodb_write_policy" {
120120
aws_dynamodb_table.ndr_dynamodb_table.arn,
121121
]
122122
}
123+
}
124+
125+
data "aws_iam_policy_document" "dynamodb_write_without_update_policy" {
126+
statement {
127+
effect = "Allow"
128+
actions = [
129+
"dynamodb:PutItem",
130+
"dynamodb:DeleteItem",
131+
"dynamodb:BatchWriteItem"
132+
]
133+
resources = [
134+
aws_dynamodb_table.ndr_dynamodb_table.arn,
135+
]
136+
}
123137
}

infrastructure/modules/dynamo_db/output.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ output "dynamodb_read_policy_document" {
2020

2121
output "dynamodb_write_policy_document" {
2222
value = data.aws_iam_policy_document.dynamodb_write_policy.json
23+
}
24+
25+
output "dynamodb_write_without_update_policy_document" {
26+
value = data.aws_iam_policy_document.dynamodb_write_without_update_policy.json
2327
}

infrastructure/variable.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ variable "statistics_dynamodb_table_name" {
106106
default = "ApplicationStatistics"
107107
}
108108

109+
variable "access_audit_dynamodb_table_name" {
110+
type = string
111+
description = "The name of the dynamodb table to store the audit of access to deceased patient records"
112+
default = "AccessAudit"
113+
}
114+
109115
# VPC Variables
110116

111117
variable "standalone_vpc_tag" {

0 commit comments

Comments
 (0)