Skip to content

Commit dc1de03

Browse files
[PRMP-195] Write to dynamo (bulk upload report) table for invalid file names (#406)
1 parent ca2f10f commit dc1de03

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
module "bulk-upload-metadata-processor-lambda" {
2+
source = "./modules/lambda"
3+
name = "BulkUploadMetadataProcessor"
4+
handler = "handlers.bulk_upload_metadata_processor_handler.lambda_handler"
5+
lambda_timeout = 900
6+
memory_size = 1769
7+
iam_role_policy_documents = [
8+
module.ndr-bulk-staging-store.s3_read_policy_document,
9+
module.ndr-bulk-staging-store.s3_write_policy_document,
10+
module.bulk_upload_report_dynamodb_table.dynamodb_read_policy_document,
11+
module.bulk_upload_report_dynamodb_table.dynamodb_write_policy_document,
12+
module.sqs-lg-bulk-upload-metadata-queue.sqs_read_policy_document,
13+
module.sqs-lg-bulk-upload-metadata-queue.sqs_write_policy_document,
14+
module.ndr-app-config.app_config_policy
15+
]
16+
17+
rest_api_id = null
18+
api_execution_arn = null
19+
20+
lambda_environment_variables = {
21+
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
22+
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
23+
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
24+
WORKSPACE = terraform.workspace
25+
STAGING_STORE_BUCKET_NAME = "${terraform.workspace}-${var.staging_store_bucket_name}"
26+
BULK_UPLOAD_DYNAMODB_NAME = "${terraform.workspace}_${var.bulk_upload_report_dynamodb_table_name}"
27+
LLOYD_GEORGE_BUCKET_NAME = "${terraform.workspace}-${var.lloyd_george_bucket_name}"
28+
LLOYD_GEORGE_DYNAMODB_NAME = "${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}"
29+
METADATA_SQS_QUEUE_URL = module.sqs-lg-bulk-upload-metadata-queue.sqs_url
30+
}
31+
is_gateway_integration_needed = false
32+
is_invoked_from_gateway = false
33+
}
34+
35+
module "bulk-upload-metadata-processor-alarm" {
36+
source = "./modules/lambda_alarms"
37+
lambda_function_name = module.bulk-upload-metadata-processor-lambda.function_name
38+
lambda_timeout = module.bulk-upload-metadata-processor-lambda.timeout
39+
lambda_name = "bulk_upload_metadata_processor_handler"
40+
namespace = "AWS/Lambda"
41+
alarm_actions = [module.bulk-upload-metadata-processor-alarm-topic.arn]
42+
ok_actions = [module.bulk-upload-metadata-processor-alarm-topic.arn]
43+
depends_on = [module.bulk-upload-metadata-processor-lambda, module.bulk-upload-metadata-processor-alarm-topic]
44+
}
45+
46+
module "bulk-upload-metadata-processor-alarm-topic" {
47+
source = "./modules/sns"
48+
sns_encryption_key_id = module.sns_encryption_key.id
49+
topic_name = "bulk-upload-metadata-processor-topic"
50+
topic_protocol = "lambda"
51+
topic_endpoint = module.bulk-upload-metadata-processor-lambda.lambda_arn
52+
delivery_policy = jsonencode({
53+
"Version" : "2012-10-17",
54+
"Statement" : [
55+
{
56+
"Effect" : "Allow",
57+
"Principal" : {
58+
"Service" : "cloudwatch.amazonaws.com"
59+
},
60+
"Action" : [
61+
"SNS:Publish",
62+
],
63+
"Condition" : {
64+
"ArnLike" : {
65+
"aws:SourceArn" : "arn:aws:cloudwatch:eu-west-2:${data.aws_caller_identity.current.account_id}:alarm:*"
66+
}
67+
}
68+
"Resource" : "*"
69+
}
70+
]
71+
})
72+
73+
depends_on = [module.bulk-upload-metadata-processor-lambda, module.sns_encryption_key]
74+
}

0 commit comments

Comments
 (0)