Skip to content

Commit 77684c4

Browse files
committed
[PRM-823] Remove references to document store and related resources from backup and Lambda configurations
Signed-off-by: NogaNHS <127490765+NogaNHS@users.noreply.github.com>
1 parent 2d99b47 commit 77684c4

19 files changed

Lines changed: 33 additions & 190 deletions

infrastructure/backup-cross-account.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ resource "aws_backup_selection" "cross_account_backup_selection" {
5353
plan_id = aws_backup_plan.cross_account_backup_schedule[0].id
5454

5555
resources = [
56-
module.ndr-document-store.bucket_arn,
5756
module.ndr-lloyd-george-store.bucket_arn,
58-
module.document_reference_dynamodb_table.dynamodb_table_arn,
5957
module.lloyd_george_reference_dynamodb_table.dynamodb_table_arn,
6058
module.bulk_upload_report_dynamodb_table.dynamodb_table_arn,
6159
module.statistical-reports-store.bucket_arn,

infrastructure/backups.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ resource "aws_backup_selection" "s3_continuous_backup" {
2424
plan_id = aws_backup_plan.s3_continuous_backup.id
2525

2626
resources = [
27-
module.ndr-document-store.bucket_arn,
2827
module.ndr-lloyd-george-store.bucket_arn,
2928
module.statistical-reports-store.bucket_arn,
3029
module.ndr-document-pending-review-store.bucket_arn

infrastructure/buckets.tf

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,6 @@ locals {
44
}
55

66
# Bucket Modules
7-
module "ndr-document-store" {
8-
source = "./modules/s3/"
9-
access_logs_enabled = local.is_production
10-
access_logs_bucket_id = local.access_logs_bucket_id
11-
bucket_name = var.docstore_bucket_name
12-
enable_cors_configuration = true
13-
enable_bucket_versioning = true
14-
environment = var.environment
15-
owner = var.owner
16-
force_destroy = local.is_force_destroy
17-
cors_rules = [
18-
{
19-
allowed_headers = ["*"]
20-
allowed_methods = ["POST", "PUT", "DELETE"]
21-
allowed_origins = [local.base_url]
22-
expose_headers = ["ETag"]
23-
max_age_seconds = 3000
24-
},
25-
{
26-
allowed_methods = ["GET"]
27-
allowed_origins = [local.base_url]
28-
}
29-
]
30-
}
31-
327
module "ndr-zip-request-store" {
338
source = "./modules/s3/"
349
access_logs_enabled = local.is_production
@@ -209,19 +184,6 @@ resource "aws_s3_bucket_lifecycle_configuration" "lg-lifecycle-rules" {
209184
}
210185
}
211186

212-
resource "aws_s3_bucket_lifecycle_configuration" "doc-store-lifecycle-rules" {
213-
bucket = module.ndr-document-store.bucket_id
214-
rule {
215-
id = "default-to-intelligent-tiering"
216-
status = "Enabled"
217-
transition {
218-
storage_class = "INTELLIGENT_TIERING"
219-
days = 0
220-
}
221-
filter {}
222-
}
223-
}
224-
225187
resource "aws_s3_bucket_lifecycle_configuration" "staging-store-lifecycle-rules" {
226188
bucket = module.ndr-bulk-staging-store.bucket_id
227189

infrastructure/dynamo_db.tf

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,3 @@
1-
module "document_reference_dynamodb_table" {
2-
source = "./modules/dynamo_db"
3-
table_name = var.docstore_dynamodb_table_name
4-
hash_key = "ID"
5-
deletion_protection_enabled = var.deletion_protection_enabled
6-
stream_view_type = "OLD_IMAGE"
7-
ttl_enabled = true
8-
ttl_attribute_name = "TTL"
9-
point_in_time_recovery_enabled = !local.is_sandbox
10-
11-
attributes = [
12-
{
13-
name = "ID"
14-
type = "S"
15-
},
16-
{
17-
name = "FileLocation"
18-
type = "S"
19-
},
20-
{
21-
name = "NhsNumber"
22-
type = "S"
23-
}
24-
]
25-
26-
global_secondary_indexes = [
27-
{
28-
name = "FileLocationsIndex"
29-
hash_key = "FileLocation"
30-
projection_type = "ALL"
31-
},
32-
{
33-
name = "NhsNumberIndex"
34-
hash_key = "NhsNumber"
35-
projection_type = "ALL"
36-
}
37-
]
38-
39-
environment = var.environment
40-
owner = var.owner
41-
}
421

432
module "cloudfront_edge_dynamodb_table" {
443
source = "./modules/dynamo_db"

infrastructure/ecs.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ module "ndr-ecs-fargate-data-collection" {
6565
"name" : "LLOYD_GEORGE_DYNAMODB_NAME",
6666
"value" : "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
6767
},
68-
{
69-
"name" : "DOCUMENT_STORE_BUCKET_NAME",
70-
"value" : "${terraform.workspace}-${var.docstore_bucket_name}"
71-
},
72-
{
73-
"name" : "DOCUMENT_STORE_DYNAMODB_NAME",
74-
"value" : "${terraform.workspace}_${var.docstore_dynamodb_table_name}"
75-
},
7668
{
7769
"name" : "STATISTICAL_REPORTS_BUCKET",
7870
"value" : "${terraform.workspace}-${var.statistical_reports_bucket_name}"

infrastructure/iam.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resource "aws_iam_policy" "s3_document_data_policy_put_only" {
99
"Action" : [
1010
"s3:PutObject",
1111
],
12-
"Resource" : ["${module.ndr-bulk-staging-store.bucket_arn}/*", "${module.ndr-document-store.bucket_arn}/*"]
12+
"Resource" : ["${module.ndr-bulk-staging-store.bucket_arn}/*"]
1313
}
1414
]
1515
})

infrastructure/lambda-create-doc-ref.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ module "create-doc-ref-lambda" {
4949
module.ndr-bulk-staging-store.s3_write_policy_document,
5050
module.ndr-lloyd-george-store.s3_write_policy_document,
5151
module.ndr-lloyd-george-store.s3_read_policy_document,
52-
module.ndr-document-store.s3_read_policy_document,
53-
module.ndr-document-store.s3_write_policy_document,
54-
module.document_reference_dynamodb_table.dynamodb_write_policy_document,
55-
module.document_reference_dynamodb_table.dynamodb_read_policy_document,
5652
module.stitch_metadata_reference_dynamodb_table.dynamodb_read_policy_document,
5753
module.stitch_metadata_reference_dynamodb_table.dynamodb_write_policy_document,
5854
module.lloyd_george_reference_dynamodb_table.dynamodb_write_policy_document,
@@ -71,8 +67,6 @@ module "create-doc-ref-lambda" {
7167
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
7268
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
7369
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
74-
DOCUMENT_STORE_BUCKET_NAME = "${terraform.workspace}-${var.docstore_bucket_name}"
75-
DOCUMENT_STORE_DYNAMODB_NAME = "${terraform.workspace}_${var.docstore_dynamodb_table_name}"
7670
LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
7771
STITCH_METADATA_DYNAMODB_NAME = "${terraform.workspace}_${var.stitch_metadata_dynamodb_table_name}"
7872
PDS_FHIR_IS_STUBBED = local.is_sandbox,
@@ -82,12 +76,10 @@ module "create-doc-ref-lambda" {
8276
depends_on = [
8377
module.document_reference_gateway,
8478
aws_api_gateway_rest_api.ndr_doc_store_api,
85-
module.document_reference_dynamodb_table,
8679
module.lloyd_george_reference_dynamodb_table,
8780
module.ndr-bulk-staging-store,
8881
module.ndr-app-config,
8982
module.lloyd_george_reference_dynamodb_table,
90-
module.document_reference_dynamodb_table,
9183
module.stitch_metadata_reference_dynamodb_table
9284
]
9385
}

infrastructure/lambda-data-collection.tf

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,22 @@ module "data-collection-lambda" {
5353
module.statistics_dynamodb_table.dynamodb_write_policy_document,
5454
module.ndr-lloyd-george-store.s3_read_policy_document,
5555
module.ndr-lloyd-george-store.s3_write_policy_document,
56-
module.ndr-document-store.s3_read_policy_document,
57-
module.ndr-document-store.s3_write_policy_document,
5856
module.lloyd_george_reference_dynamodb_table.dynamodb_read_policy_document,
5957
module.lloyd_george_reference_dynamodb_table.dynamodb_write_policy_document,
60-
module.document_reference_dynamodb_table.dynamodb_read_policy_document,
61-
module.document_reference_dynamodb_table.dynamodb_write_policy_document,
6258
aws_iam_policy.cloudwatch_log_query_policy.policy
6359
]
6460
kms_deletion_window = var.kms_deletion_window
6561
rest_api_id = null
6662
api_execution_arn = null
6763

6864
lambda_environment_variables = {
69-
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
70-
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
71-
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
72-
LLOYD_GEORGE_BUCKET_NAME = "${terraform.workspace}-${var.lloyd_george_bucket_name}"
73-
LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
74-
DOCUMENT_STORE_BUCKET_NAME = "${terraform.workspace}-${var.docstore_bucket_name}"
75-
DOCUMENT_STORE_DYNAMODB_NAME = "${terraform.workspace}_${var.docstore_dynamodb_table_name}"
76-
WORKSPACE = terraform.workspace
77-
STATISTICS_TABLE = "${terraform.workspace}_${var.statistics_dynamodb_table_name}"
65+
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
66+
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
67+
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
68+
LLOYD_GEORGE_BUCKET_NAME = "${terraform.workspace}-${var.lloyd_george_bucket_name}"
69+
LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
70+
WORKSPACE = terraform.workspace
71+
STATISTICS_TABLE = "${terraform.workspace}_${var.statistics_dynamodb_table_name}"
7872
}
7973
is_gateway_integration_needed = false
8074
is_invoked_from_gateway = false
@@ -83,8 +77,6 @@ module "data-collection-lambda" {
8377
module.ndr-app-config,
8478
module.statistics_dynamodb_table,
8579
module.lloyd_george_reference_dynamodb_table,
86-
module.document_reference_dynamodb_table,
87-
module.ndr-document-store,
8880
module.ndr-lloyd-george-store,
8981
aws_iam_policy.cloudwatch_log_query_policy
9082
]

infrastructure/lambda-delete-doc-ref.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ module "delete-doc-ref-lambda" {
5656
name = "DeleteDocRefLambda"
5757
handler = "handlers.delete_document_reference_handler.lambda_handler"
5858
iam_role_policy_documents = [
59-
module.document_reference_dynamodb_table.dynamodb_read_policy_document,
60-
module.document_reference_dynamodb_table.dynamodb_write_policy_document,
61-
module.ndr-document-store.s3_read_policy_document,
62-
module.ndr-document-store.s3_write_policy_document,
6359
module.lloyd_george_reference_dynamodb_table.dynamodb_read_policy_document,
6460
module.lloyd_george_reference_dynamodb_table.dynamodb_write_policy_document,
6561
module.ndr-lloyd-george-store.s3_read_policy_document,
@@ -81,7 +77,6 @@ module "delete-doc-ref-lambda" {
8177
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
8278
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
8379
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
84-
DOCUMENT_STORE_DYNAMODB_NAME = "${terraform.workspace}_${var.docstore_dynamodb_table_name}"
8580
LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
8681
STITCH_METADATA_DYNAMODB_NAME = "${terraform.workspace}_${var.stitch_metadata_dynamodb_table_name}"
8782
UNSTITCHED_LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.unstitched_lloyd_george_dynamodb_table_name}"
@@ -90,7 +85,6 @@ module "delete-doc-ref-lambda" {
9085
}
9186
depends_on = [
9287
aws_api_gateway_rest_api.ndr_doc_store_api,
93-
module.document_reference_dynamodb_table,
9488
module.stitch_metadata_reference_dynamodb_table,
9589
module.delete-doc-ref-gateway,
9690
module.ndr-app-config

infrastructure/lambda-delete-document-fhir.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ module "delete-document-references-fhir-lambda" {
1515
module.ndr-lloyd-george-store.s3_read_policy_document,
1616
module.pdm-document-store.s3_write_policy_document,
1717
module.ndr-lloyd-george-store.s3_write_policy_document,
18-
module.document_reference_dynamodb_table.dynamodb_read_policy_document,
19-
module.document_reference_dynamodb_table.dynamodb_write_policy_document,
20-
module.ndr-document-store.s3_read_policy_document,
21-
module.ndr-document-store.s3_write_policy_document,
2218
module.stitch_metadata_reference_dynamodb_table.dynamodb_read_policy_document,
2319
module.stitch_metadata_reference_dynamodb_table.dynamodb_write_policy_document,
2420
module.sqs-nrl-queue.sqs_read_policy_document,
@@ -39,7 +35,6 @@ module "delete-document-references-fhir-lambda" {
3935
ENVIRONMENT = var.environment
4036
LLOYD_GEORGE_BUCKET_NAME = "${terraform.workspace}-${var.lloyd_george_bucket_name}"
4137
LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
42-
DOCUMENT_STORE_DYNAMODB_NAME = "${terraform.workspace}_${var.docstore_dynamodb_table_name}"
4338
STITCH_METADATA_DYNAMODB_NAME = "${terraform.workspace}_${var.stitch_metadata_dynamodb_table_name}"
4439
UNSTITCHED_LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.unstitched_lloyd_george_dynamodb_table_name}"
4540
NRL_SQS_QUEUE_URL = module.sqs-nrl-queue.sqs_url
@@ -48,7 +43,6 @@ module "delete-document-references-fhir-lambda" {
4843
module.lloyd_george_reference_dynamodb_table,
4944
module.core_dynamodb_table,
5045
aws_api_gateway_rest_api.ndr_doc_store_api,
51-
module.document_reference_dynamodb_table,
5246
module.stitch_metadata_reference_dynamodb_table,
5347
module.ndr-app-config
5448
]

0 commit comments

Comments
 (0)