Skip to content

Commit

Permalink
Add bulk upload report lambda infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
RioKnightleyNHS authored Oct 23, 2023
1 parent 61d3523 commit 5638c98
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
| <a name="module_back_channel_logout_lambda"></a> [back\_channel\_logout\_lambda](#module\_back\_channel\_logout\_lambda) | ./modules/lambda | n/a |
| <a name="module_bulk-upload-lambda"></a> [bulk-upload-lambda](#module\_bulk-upload-lambda) | ./modules/lambda | n/a |
| <a name="module_bulk-upload-metadata-lambda"></a> [bulk-upload-metadata-lambda](#module\_bulk-upload-metadata-lambda) | ./modules/lambda | n/a |
| <a name="module_bulk-upload-report-lambda"></a> [bulk-upload-report-lambda](#module\_bulk-upload-report-lambda) | ./modules/lambda | n/a |
| <a name="module_bulk_upload_dynamodb_table"></a> [bulk\_upload\_dynamodb\_table](#module\_bulk\_upload\_dynamodb\_table) | ./modules/dynamo_db | n/a |
| <a name="module_create-doc-ref-gateway"></a> [create-doc-ref-gateway](#module\_create-doc-ref-gateway) | ./modules/gateway | n/a |
| <a name="module_create-doc-ref-lambda"></a> [create-doc-ref-lambda](#module\_create-doc-ref-lambda) | ./modules/lambda | n/a |
Expand Down Expand Up @@ -97,7 +98,8 @@
| [aws_iam_policy.ssm_policy_pds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
| [aws_iam_policy.ssm_policy_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
| [aws_lambda_event_source_mapping.bulk_upload_lambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping) | resource |
| [aws_s3_bucket_lifecycle_configuration.ndr-lifecycle-rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.doc-store-lifecycle-rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_lifecycle_configuration.lg-lifecycle-rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.alarm_notification_kms_key_policy_doc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |

Expand Down
1 change: 1 addition & 0 deletions infrastructure/lambda-bulk-upload-metadata.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module "bulk-upload-metadata-lambda" {
is_invoked_from_gateway = false

depends_on = [
aws_api_gateway_rest_api.ndr_doc_store_api,
module.ndr-bulk-staging-store,
module.sqs-lg-bulk-upload-metadata-queue,
]
Expand Down
26 changes: 26 additions & 0 deletions infrastructure/lambda-bulk-upload-report.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module "bulk-upload-report-lambda" {
source = "./modules/lambda"
name = "BulkUploadReportLambda"
handler = "handlers.bulk_upload_report_handler.lambda_handler"
iam_role_policies = [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
"arn:aws:iam::aws:policy/CloudWatchLambdaInsightsExecutionRolePolicy",
module.ndr-bulk-staging-store.s3_object_access_policy,
module.bulk_upload_dynamodb_table.dynamodb_policy
]
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
api_execution_arn = aws_api_gateway_rest_api.ndr_doc_store_api.execution_arn
lambda_environment_variables = {
WORKSPACE = terraform.workspace
STAGING_STORE_BUCKET_NAME = "${terraform.workspace}-${var.staging_store_bucket_name}"
BULK_UPLOAD_DYNAMODB = "${terraform.workspace}_${var.bulk_upload_dynamodb_table_name}"
}
is_gateway_integration_needed = false
is_invoked_from_gateway = false

depends_on = [
aws_api_gateway_rest_api.ndr_doc_store_api,
module.ndr-bulk-staging-store,
module.bulk_upload_dynamodb_table
]
}
1 change: 1 addition & 0 deletions infrastructure/modules/dynamo_db/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ resource "aws_dynamodb_table" "ndr_dynamodb_table" {
Workspace = terraform.workspace
}
}

resource "aws_iam_policy" "dynamodb_policy" {
name = "${terraform.workspace}_${var.table_name}_policy"
path = "/"
Expand Down

0 comments on commit 5638c98

Please sign in to comment.