diff --git a/infrastructure/lambda-access-audit.tf b/infrastructure/lambda-access-audit.tf
index 7afefd1ac..5163adc17 100644
--- a/infrastructure/lambda-access-audit.tf
+++ b/infrastructure/lambda-access-audit.tf
@@ -14,7 +14,6 @@ module "access-audit-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.access-audit-lambda.function_name
lambda_timeout = module.access-audit-lambda.timeout
- lambda_name = "access_audit_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.access-audit-alarm-topic.arn]
ok_actions = [module.access-audit-alarm-topic.arn]
diff --git a/infrastructure/lambda-authoriser.tf b/infrastructure/lambda-authoriser.tf
index 48c97563b..b2b3f4175 100644
--- a/infrastructure/lambda-authoriser.tf
+++ b/infrastructure/lambda-authoriser.tf
@@ -35,7 +35,6 @@ module "authoriser-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.authoriser-lambda.function_name
lambda_timeout = module.authoriser-lambda.timeout
- lambda_name = "authoriser_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.authoriser-alarm-topic.arn]
ok_actions = [module.authoriser-alarm-topic.arn]
diff --git a/infrastructure/lambda-back-channel-logout.tf b/infrastructure/lambda-back-channel-logout.tf
index da0c936ac..1943caa79 100644
--- a/infrastructure/lambda-back-channel-logout.tf
+++ b/infrastructure/lambda-back-channel-logout.tf
@@ -47,7 +47,6 @@ module "back_channel_logout_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.back_channel_logout_lambda.function_name
lambda_timeout = module.back_channel_logout_lambda.timeout
- lambda_name = "back_channel_logout_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.back_channel_logout_alarm_topic.arn]
ok_actions = [module.back_channel_logout_alarm_topic.arn]
diff --git a/infrastructure/lambda-bulk-upload-metadata-processor.tf b/infrastructure/lambda-bulk-upload-metadata-processor.tf
index d34aec5dc..4cf83c6d0 100644
--- a/infrastructure/lambda-bulk-upload-metadata-processor.tf
+++ b/infrastructure/lambda-bulk-upload-metadata-processor.tf
@@ -47,7 +47,6 @@ module "bulk-upload-metadata-processor-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.bulk-upload-metadata-processor-lambda.function_name
lambda_timeout = module.bulk-upload-metadata-processor-lambda.timeout
- lambda_name = "bulk_upload_metadata_processor_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.bulk-upload-metadata-processor-alarm-topic.arn]
ok_actions = [module.bulk-upload-metadata-processor-alarm-topic.arn]
diff --git a/infrastructure/lambda-bulk-upload-metadata.tf b/infrastructure/lambda-bulk-upload-metadata.tf
index 1e2407a2a..25aae34c9 100644
--- a/infrastructure/lambda-bulk-upload-metadata.tf
+++ b/infrastructure/lambda-bulk-upload-metadata.tf
@@ -32,7 +32,6 @@ module "bulk-upload-metadata-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.bulk-upload-metadata-lambda.function_name
lambda_timeout = module.bulk-upload-metadata-lambda.timeout
- lambda_name = "bulk_upload_metadata_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.bulk-upload-metadata-alarm-topic.arn]
ok_actions = [module.bulk-upload-metadata-alarm-topic.arn]
diff --git a/infrastructure/lambda-bulk-upload-report.tf b/infrastructure/lambda-bulk-upload-report.tf
index 4c2dc97b9..e5e290f1c 100644
--- a/infrastructure/lambda-bulk-upload-report.tf
+++ b/infrastructure/lambda-bulk-upload-report.tf
@@ -53,7 +53,6 @@ module "bulk-upload-report-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.bulk-upload-report-lambda.function_name
lambda_timeout = module.bulk-upload-report-lambda.timeout
- lambda_name = "bulk_upload_report_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.bulk-upload-report-alarm-topic.arn]
ok_actions = [module.bulk-upload-report-alarm-topic.arn]
diff --git a/infrastructure/lambda-bulk-upload.tf b/infrastructure/lambda-bulk-upload.tf
index 45e5b994a..6f8a2037d 100644
--- a/infrastructure/lambda-bulk-upload.tf
+++ b/infrastructure/lambda-bulk-upload.tf
@@ -90,7 +90,6 @@ module "bulk-upload-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.bulk-upload-lambda.function_name
lambda_timeout = module.bulk-upload-lambda.timeout
- lambda_name = "bulk_upload_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.bulk-upload-alarm-topic.arn]
ok_actions = [module.bulk-upload-alarm-topic.arn]
diff --git a/infrastructure/lambda-create-doc-ref.tf b/infrastructure/lambda-create-doc-ref.tf
index 5c7e30ab4..5d3d749de 100644
--- a/infrastructure/lambda-create-doc-ref.tf
+++ b/infrastructure/lambda-create-doc-ref.tf
@@ -2,7 +2,6 @@ module "create_doc_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.create-doc-ref-lambda.function_name
lambda_timeout = module.create-doc-ref-lambda.timeout
- lambda_name = "create_document_reference_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.create_doc_alarm_topic.arn]
ok_actions = [module.create_doc_alarm_topic.arn]
diff --git a/infrastructure/lambda-data-collection.tf b/infrastructure/lambda-data-collection.tf
index c9d291382..ab13f43d1 100644
--- a/infrastructure/lambda-data-collection.tf
+++ b/infrastructure/lambda-data-collection.tf
@@ -2,7 +2,6 @@ module "data-collection-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.data-collection-lambda.function_name
lambda_timeout = module.data-collection-lambda.timeout
- lambda_name = "data_collection_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.data-collection-alarm-topic.arn]
ok_actions = [module.data-collection-alarm-topic.arn]
diff --git a/infrastructure/lambda-delete-doc-object.tf b/infrastructure/lambda-delete-doc-object.tf
index 4fde310ae..301a95c45 100644
--- a/infrastructure/lambda-delete-doc-object.tf
+++ b/infrastructure/lambda-delete-doc-object.tf
@@ -2,7 +2,6 @@ module "delete-document-object-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.delete-document-object-lambda.function_name
lambda_timeout = module.delete-document-object-lambda.timeout
- lambda_name = "delete_document_object_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.delete-document-object-alarm-topic.arn]
ok_actions = [module.delete-document-object-alarm-topic.arn]
diff --git a/infrastructure/lambda-delete-doc-ref.tf b/infrastructure/lambda-delete-doc-ref.tf
index 62223c7b1..5db2a81e2 100644
--- a/infrastructure/lambda-delete-doc-ref.tf
+++ b/infrastructure/lambda-delete-doc-ref.tf
@@ -14,7 +14,6 @@ module "delete_doc_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.delete-doc-ref-lambda.function_name
lambda_timeout = module.delete-doc-ref-lambda.timeout
- lambda_name = "delete_document_reference_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.delete_doc_alarm_topic.arn]
ok_actions = [module.delete_doc_alarm_topic.arn]
diff --git a/infrastructure/lambda-document-manifest-job.tf b/infrastructure/lambda-document-manifest-job.tf
index ea94ce914..542f8c73a 100644
--- a/infrastructure/lambda-document-manifest-job.tf
+++ b/infrastructure/lambda-document-manifest-job.tf
@@ -14,7 +14,6 @@ module "document_manifest_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.document-manifest-job-lambda.function_name
lambda_timeout = module.document-manifest-job-lambda.timeout
- lambda_name = "create_document_manifest_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.document_manifest_alarm_topic.arn]
ok_actions = [module.document_manifest_alarm_topic.arn]
diff --git a/infrastructure/lambda-document-status-check-result.tf b/infrastructure/lambda-document-status-check-result.tf
index b37f3acb4..eacfd05f3 100644
--- a/infrastructure/lambda-document-status-check-result.tf
+++ b/infrastructure/lambda-document-status-check-result.tf
@@ -14,7 +14,6 @@ module "document-status-check-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.document-status-check-lambda.function_name
lambda_timeout = module.document-status-check-lambda.timeout
- lambda_name = "document_status_check_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.document-status-check-alarm-topic.arn]
ok_actions = [module.document-status-check-alarm-topic.arn]
diff --git a/infrastructure/lambda-edge-presign.tf b/infrastructure/lambda-edge-presign.tf
index 60b2d95e4..80f533ceb 100644
--- a/infrastructure/lambda-edge-presign.tf
+++ b/infrastructure/lambda-edge-presign.tf
@@ -2,11 +2,14 @@ module "edge_presign_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.edge-presign-lambda.function_name
lambda_timeout = module.edge-presign-lambda.timeout
- lambda_name = "edge_presign_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.edge_presign_alarm_topic.arn]
ok_actions = [module.edge_presign_alarm_topic.arn]
depends_on = [module.edge-presign-lambda, module.edge_presign_alarm_topic]
+
+ providers = {
+ aws = aws.us_east_1
+ }
}
resource "aws_cloudwatch_log_metric_filter" "edge_presign_error" {
diff --git a/infrastructure/lambda-feature-flags.tf b/infrastructure/lambda-feature-flags.tf
index 6ddf0d8b3..1fefce093 100644
--- a/infrastructure/lambda-feature-flags.tf
+++ b/infrastructure/lambda-feature-flags.tf
@@ -14,7 +14,6 @@ module "feature_flags_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.feature-flags-lambda.function_name
lambda_timeout = module.feature-flags-lambda.timeout
- lambda_name = "feature_flags_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.feature_flags_alarm_topic.arn]
ok_actions = [module.feature_flags_alarm_topic.arn]
diff --git a/infrastructure/lambda-generate-document-manifest.tf b/infrastructure/lambda-generate-document-manifest.tf
index 8751477c1..084f574bd 100644
--- a/infrastructure/lambda-generate-document-manifest.tf
+++ b/infrastructure/lambda-generate-document-manifest.tf
@@ -2,7 +2,6 @@ module "generate-document-manifest-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.generate-document-manifest-lambda.function_name
lambda_timeout = module.generate-document-manifest-lambda.timeout
- lambda_name = "generate_document_manifest_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.generate-document-manifest-alarm-topic.arn]
ok_actions = [module.generate-document-manifest-alarm-topic.arn]
diff --git a/infrastructure/lambda-generate-stitch-record.tf b/infrastructure/lambda-generate-stitch-record.tf
index 236c5f107..fc313f8a6 100644
--- a/infrastructure/lambda-generate-stitch-record.tf
+++ b/infrastructure/lambda-generate-stitch-record.tf
@@ -2,7 +2,6 @@ module "generate-lloyd-george-stitch-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.generate-lloyd-george-stitch-lambda.function_name
lambda_timeout = module.generate-lloyd-george-stitch-lambda.timeout
- lambda_name = "generate_lloyd_george_stitch_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.generate-lloyd-george-stitch-alarm-topic.arn]
ok_actions = [module.generate-lloyd-george-stitch-alarm-topic.arn]
diff --git a/infrastructure/lambda-get-doc-ref.tf b/infrastructure/lambda-get-doc-ref.tf
index b82dacb52..030fb45e6 100644
--- a/infrastructure/lambda-get-doc-ref.tf
+++ b/infrastructure/lambda-get-doc-ref.tf
@@ -2,7 +2,6 @@ module "get-doc-ref-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.get-doc-ref-lambda.function_name
lambda_timeout = module.get-doc-ref-lambda.timeout
- lambda_name = "get_document_reference_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.get-doc-ref-alarm-topic.arn]
ok_actions = [module.get-doc-ref-alarm-topic.arn]
diff --git a/infrastructure/lambda-get-document-review.tf b/infrastructure/lambda-get-document-review.tf
index 7bbd73cb9..62e25ce0b 100644
--- a/infrastructure/lambda-get-document-review.tf
+++ b/infrastructure/lambda-get-document-review.tf
@@ -40,7 +40,6 @@ module "get_document_review_lambda_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.get_document_review_lambda.function_name
lambda_timeout = module.get_document_review_lambda.timeout
- lambda_name = "get_document_review_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.get_document_review_lambda_alarm_topic.arn]
ok_actions = [module.get_document_review_lambda_alarm_topic.arn]
diff --git a/infrastructure/lambda-get-report-by-ods.tf b/infrastructure/lambda-get-report-by-ods.tf
index a0e596919..8947928d5 100644
--- a/infrastructure/lambda-get-report-by-ods.tf
+++ b/infrastructure/lambda-get-report-by-ods.tf
@@ -14,7 +14,6 @@ module "get-report-by-ods-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.get-report-by-ods-lambda.function_name
lambda_timeout = module.get-report-by-ods-lambda.timeout
- lambda_name = "get_report_by_ods_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.get-report-by-ods-alarm-topic.arn]
ok_actions = [module.get-report-by-ods-alarm-topic.arn]
diff --git a/infrastructure/lambda-lloyd-george-record-stitch.tf b/infrastructure/lambda-lloyd-george-record-stitch.tf
index c0b26d1c8..f981fb091 100644
--- a/infrastructure/lambda-lloyd-george-record-stitch.tf
+++ b/infrastructure/lambda-lloyd-george-record-stitch.tf
@@ -14,7 +14,6 @@ module "lloyd-george-stitch_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.lloyd-george-stitch-lambda.function_name
lambda_timeout = module.lloyd-george-stitch-lambda.timeout
- lambda_name = "lloyd_george_record_stitch_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.lloyd-george-stitch_topic.arn]
ok_actions = [module.lloyd-george-stitch_topic.arn]
diff --git a/infrastructure/lambda-login-redirect.tf b/infrastructure/lambda-login-redirect.tf
index 9c6ecab77..cf4335acd 100644
--- a/infrastructure/lambda-login-redirect.tf
+++ b/infrastructure/lambda-login-redirect.tf
@@ -51,7 +51,6 @@ module "login_redirect_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.login_redirect_lambda.function_name
lambda_timeout = module.login_redirect_lambda.timeout
- lambda_name = "login_redirect_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.login_redirect-alarm_topic.arn]
ok_actions = [module.login_redirect-alarm_topic.arn]
diff --git a/infrastructure/lambda-logout.tf b/infrastructure/lambda-logout.tf
index d797dfeb7..2925662e2 100644
--- a/infrastructure/lambda-logout.tf
+++ b/infrastructure/lambda-logout.tf
@@ -45,7 +45,6 @@ module "logout_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.logout_lambda.function_name
lambda_timeout = module.logout_lambda.timeout
- lambda_name = "logout_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.logout_alarm_topic.arn]
ok_actions = [module.logout_alarm_topic.arn]
diff --git a/infrastructure/lambda-manage-nrl-pointer.tf b/infrastructure/lambda-manage-nrl-pointer.tf
index d55421b78..c906e9ccf 100644
--- a/infrastructure/lambda-manage-nrl-pointer.tf
+++ b/infrastructure/lambda-manage-nrl-pointer.tf
@@ -32,7 +32,6 @@ module "manage-nrl-pointer-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.manage-nrl-pointer-lambda.function_name
lambda_timeout = module.manage-nrl-pointer-lambda.timeout
- lambda_name = "manage_nrl_pointer_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.manage-nrl-pointer-alarm-topic.arn]
ok_actions = [module.manage-nrl-pointer-alarm-topic.arn]
diff --git a/infrastructure/lambda-mns-notification.tf b/infrastructure/lambda-mns-notification.tf
index 8b9bcede7..c7c863930 100644
--- a/infrastructure/lambda-mns-notification.tf
+++ b/infrastructure/lambda-mns-notification.tf
@@ -41,7 +41,6 @@ module "mns-notification-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.mns-notification-lambda[0].function_name
lambda_timeout = module.mns-notification-lambda[0].timeout
- lambda_name = "mns_notification_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.mns-notification-alarm-topic[0].arn]
ok_actions = [module.mns-notification-alarm-topic[0].arn]
diff --git a/infrastructure/lambda-nhs-oauth-token-generator.tf b/infrastructure/lambda-nhs-oauth-token-generator.tf
index 99bcbba79..cf72ea0aa 100644
--- a/infrastructure/lambda-nhs-oauth-token-generator.tf
+++ b/infrastructure/lambda-nhs-oauth-token-generator.tf
@@ -23,7 +23,6 @@ module "nhs-oauth-token-generator-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.nhs-oauth-token-generator-lambda.function_name
lambda_timeout = module.nhs-oauth-token-generator-lambda.timeout
- lambda_name = "nhs_oauth_token_generator_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.nhs-oauth-token-generator-alarm-topic.arn]
ok_actions = [module.nhs-oauth-token-generator-alarm-topic.arn]
diff --git a/infrastructure/lambda-patch-document-review.tf b/infrastructure/lambda-patch-document-review.tf
index c23680008..dd6403fd4 100644
--- a/infrastructure/lambda-patch-document-review.tf
+++ b/infrastructure/lambda-patch-document-review.tf
@@ -36,7 +36,6 @@ module "patch_document_review_lambda_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.patch_document_review_lambda.function_name
lambda_timeout = module.patch_document_review_lambda.timeout
- lambda_name = "patch_document_review_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.patch_document_review_lambda_alarm_topic.arn]
ok_actions = [module.patch_document_review_lambda_alarm_topic.arn]
diff --git a/infrastructure/lambda-pdf-stitching.tf b/infrastructure/lambda-pdf-stitching.tf
index d3df51ec9..2b59da0a5 100644
--- a/infrastructure/lambda-pdf-stitching.tf
+++ b/infrastructure/lambda-pdf-stitching.tf
@@ -40,7 +40,6 @@ module "pdf-stitching-lambda-alarms" {
source = "./modules/lambda_alarms"
lambda_function_name = module.pdf-stitching-lambda.function_name
lambda_timeout = module.pdf-stitching-lambda.timeout
- lambda_name = "PdfStitchingLambda"
namespace = "AWS/Lambda"
alarm_actions = [module.pdf-stitching-alarm-topic.arn]
ok_actions = [module.pdf-stitching-alarm-topic.arn]
diff --git a/infrastructure/lambda-post-document-review.tf b/infrastructure/lambda-post-document-review.tf
index 8f638635f..de68072b2 100644
--- a/infrastructure/lambda-post-document-review.tf
+++ b/infrastructure/lambda-post-document-review.tf
@@ -41,7 +41,6 @@ module "post_document_review_lambda_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.post_document_review_lambda.function_name
lambda_timeout = module.post_document_review_lambda.timeout
- lambda_name = "post_document_review_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.post_document_review_lambda_alarm_topic.arn]
ok_actions = [module.post_document_review_lambda_alarm_topic.arn]
diff --git a/infrastructure/lambda-review-document-status.tf b/infrastructure/lambda-review-document-status.tf
index ac29656a5..f332ca467 100644
--- a/infrastructure/lambda-review-document-status.tf
+++ b/infrastructure/lambda-review-document-status.tf
@@ -31,7 +31,6 @@ module "review-document-status-check-lambda-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.review-document-status-check-lambda.function_name
lambda_timeout = module.review-document-status-check-lambda.timeout
- lambda_name = "review_document_status_check_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.review-document-status-check-alarm-topic.arn]
ok_actions = [module.review-document-status-check-alarm-topic.arn]
diff --git a/infrastructure/lambda-search-doc-references.tf b/infrastructure/lambda-search-doc-references.tf
index 279513a83..ef6af8805 100644
--- a/infrastructure/lambda-search-doc-references.tf
+++ b/infrastructure/lambda-search-doc-references.tf
@@ -14,7 +14,6 @@ module "search_doc_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.search-document-references-lambda.function_name
lambda_timeout = module.search-document-references-lambda.timeout
- lambda_name = "search_document_references_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.search_doc_alarm_topic.arn]
ok_actions = [module.search_doc_alarm_topic.arn]
diff --git a/infrastructure/lambda-search-document-review.tf b/infrastructure/lambda-search-document-review.tf
index 40e41f59a..85ffba58d 100644
--- a/infrastructure/lambda-search-document-review.tf
+++ b/infrastructure/lambda-search-document-review.tf
@@ -33,7 +33,6 @@ module "search_document_review_lambda_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.search_document_review_lambda.function_name
lambda_timeout = module.search_document_review_lambda.timeout
- lambda_name = "search_document_review_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.search_document_review_lambda_alarm_topic.arn]
ok_actions = [module.search_document_review_lambda_alarm_topic.arn]
diff --git a/infrastructure/lambda-search-patient.tf b/infrastructure/lambda-search-patient.tf
index 100927bc2..03c239519 100644
--- a/infrastructure/lambda-search-patient.tf
+++ b/infrastructure/lambda-search-patient.tf
@@ -14,7 +14,6 @@ module "search_patient_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.search-patient-details-lambda.function_name
lambda_timeout = module.search-patient-details-lambda.timeout
- lambda_name = "search_patient_details_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.search_patient_alarm_topic.arn]
ok_actions = [module.search_patient_alarm_topic.arn]
diff --git a/infrastructure/lambda-send-feedback.tf b/infrastructure/lambda-send-feedback.tf
index b03d4ba5c..138f79531 100644
--- a/infrastructure/lambda-send-feedback.tf
+++ b/infrastructure/lambda-send-feedback.tf
@@ -37,7 +37,6 @@ module "send-feedback-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.send-feedback-lambda.function_name
lambda_timeout = module.send-feedback-lambda.timeout
- lambda_name = "send_feedback_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.send-feedback-alarm-topic.arn]
ok_actions = [module.send-feedback-alarm-topic.arn]
diff --git a/infrastructure/lambda-statistical-report.tf b/infrastructure/lambda-statistical-report.tf
index 1f2cad163..77b705071 100644
--- a/infrastructure/lambda-statistical-report.tf
+++ b/infrastructure/lambda-statistical-report.tf
@@ -2,7 +2,6 @@ module "statistical-report-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.statistical-report-lambda.function_name
lambda_timeout = module.statistical-report-lambda.timeout
- lambda_name = "statistical_report_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.statistical-report-alarm-topic.arn]
ok_actions = [module.statistical-report-alarm-topic.arn]
diff --git a/infrastructure/lambda-token.tf b/infrastructure/lambda-token.tf
index eb3c33ba2..ddd68caf4 100644
--- a/infrastructure/lambda-token.tf
+++ b/infrastructure/lambda-token.tf
@@ -53,7 +53,6 @@ module "create_token-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.create-token-lambda.function_name
lambda_timeout = module.create-token-lambda.timeout
- lambda_name = "token_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.create_token-alarm_topic.arn]
ok_actions = [module.create_token-alarm_topic.arn]
diff --git a/infrastructure/lambda-transfer-key-manager.tf b/infrastructure/lambda-transfer-key-manager.tf
index 3f1a74ab6..2e3686367 100644
--- a/infrastructure/lambda-transfer-key-manager.tf
+++ b/infrastructure/lambda-transfer-key-manager.tf
@@ -77,7 +77,6 @@ module "transfer-key-manager-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.transfer-key-manager-lambda.function_name
lambda_timeout = module.transfer-key-manager-lambda.timeout
- lambda_name = "transfer_key_manager_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.transfer-key-manager-alarm-topic.arn]
ok_actions = [module.transfer-key-manager-alarm-topic.arn]
diff --git a/infrastructure/lambda-update-doc-ref.tf b/infrastructure/lambda-update-doc-ref.tf
index be482520c..f1e1abf8c 100644
--- a/infrastructure/lambda-update-doc-ref.tf
+++ b/infrastructure/lambda-update-doc-ref.tf
@@ -2,7 +2,6 @@ module "update-doc-ref-alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.update-doc-ref-lambda.function_name
lambda_timeout = module.update-doc-ref-lambda.timeout
- lambda_name = "update_document_reference_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.update-doc-ref-alarm-topic.arn]
ok_actions = [module.update-doc-ref-alarm-topic.arn]
diff --git a/infrastructure/lambda-update-upload-state.tf b/infrastructure/lambda-update-upload-state.tf
index 2a80dbd92..8a99b1c0d 100644
--- a/infrastructure/lambda-update-upload-state.tf
+++ b/infrastructure/lambda-update-upload-state.tf
@@ -14,7 +14,6 @@ module "update_upload_state_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.update-upload-state-lambda.function_name
lambda_timeout = module.update-upload-state-lambda.timeout
- lambda_name = "update_upload_state_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.update_upload_state_alarm_topic.arn]
ok_actions = [module.update_upload_state_alarm_topic.arn]
diff --git a/infrastructure/lambda-virus-scan-result.tf b/infrastructure/lambda-virus-scan-result.tf
index bb39c114d..a324ce580 100644
--- a/infrastructure/lambda-virus-scan-result.tf
+++ b/infrastructure/lambda-virus-scan-result.tf
@@ -14,7 +14,6 @@ module "virus_scan_result_alarm" {
source = "./modules/lambda_alarms"
lambda_function_name = module.virus_scan_result_lambda.function_name
lambda_timeout = module.virus_scan_result_lambda.timeout
- lambda_name = "virus_scan_result_handler"
namespace = "AWS/Lambda"
alarm_actions = [module.virus_scan_result_alarm_topic.arn]
ok_actions = [module.virus_scan_result_alarm_topic.arn]
diff --git a/infrastructure/modules/lambda_alarms/README.md b/infrastructure/modules/lambda_alarms/README.md
index 2e640cf67..63893e259 100644
--- a/infrastructure/modules/lambda_alarms/README.md
+++ b/infrastructure/modules/lambda_alarms/README.md
@@ -56,6 +56,7 @@ module "lambda_alarms" {
| [aws_cloudwatch_metric_alarm.lambda_duration_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |
| [aws_cloudwatch_metric_alarm.lambda_error](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |
| [aws_cloudwatch_metric_alarm.lambda_memory_alarm](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |
+| [aws_lambda_function._](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/lambda_function) | data source |
## Inputs
@@ -63,7 +64,6 @@ module "lambda_alarms" {
|------|-------------|------|---------|:--------:|
| [alarm\_actions](#input\_alarm\_actions) | List of ARNs (e.g., SNS topics) to notify when a CloudWatch alarm is triggered. | `list(string)` | n/a | yes |
| [lambda\_function\_name](#input\_lambda\_function\_name) | The name of the Lambda function to monitor. | `string` | n/a | yes |
-| [lambda\_name](#input\_lambda\_name) | Short identifier used in CloudWatch alarm naming. | `string` | n/a | yes |
| [lambda\_timeout](#input\_lambda\_timeout) | Timeout value of the Lambda function in seconds. | `number` | n/a | yes |
| [namespace](#input\_namespace) | CloudWatch metric namespace. Defaults to 'AWS/Lambda' if not specified. | `string` | `"AWS/Lambda"` | no |
| [ok\_actions](#input\_ok\_actions) | List of ARNs to notify when a CloudWatch alarm returns to the OK state. | `list(string)` | n/a | yes |
diff --git a/infrastructure/modules/lambda_alarms/main.tf b/infrastructure/modules/lambda_alarms/main.tf
index db7647eeb..3c4a2f089 100644
--- a/infrastructure/modules/lambda_alarms/main.tf
+++ b/infrastructure/modules/lambda_alarms/main.tf
@@ -1,5 +1,13 @@
+data "aws_lambda_function" "_" {
+ function_name = var.lambda_function_name
+}
+
+locals {
+ lambda_handler_component = split(".", data.aws_lambda_function._.handler)[1]
+}
+
resource "aws_cloudwatch_metric_alarm" "lambda_error" {
- alarm_name = "${terraform.workspace}-alarm_${var.lambda_name}_error"
+ alarm_name = "${terraform.workspace}-alarm_${local.lambda_handler_component}_error"
alarm_description = "Triggers when an error has occurred in ${var.lambda_function_name}."
dimensions = {
FunctionName = var.lambda_function_name
@@ -17,7 +25,7 @@ resource "aws_cloudwatch_metric_alarm" "lambda_error" {
}
resource "aws_cloudwatch_metric_alarm" "lambda_duration_alarm" {
- alarm_name = "${terraform.workspace}-alarm_${var.lambda_name}_duration"
+ alarm_name = "${terraform.workspace}-alarm_${local.lambda_handler_component}_duration"
alarm_description = "Triggers when duration of ${var.lambda_function_name} exceeds 80% of timeout."
dimensions = {
FunctionName = var.lambda_function_name
@@ -32,7 +40,7 @@ resource "aws_cloudwatch_metric_alarm" "lambda_duration_alarm" {
}
resource "aws_cloudwatch_metric_alarm" "lambda_memory_alarm" {
- alarm_name = "${terraform.workspace}-alarm_${var.lambda_name}_memory"
+ alarm_name = "${terraform.workspace}-alarm_${local.lambda_handler_component}_memory"
alarm_description = "Triggers when max memory usage of ${var.lambda_function_name} exceeds 80% of provisioned memory."
dimensions = {
function_name = var.lambda_function_name
diff --git a/infrastructure/modules/lambda_alarms/variable.tf b/infrastructure/modules/lambda_alarms/variable.tf
index 59cac2eb8..59f930307 100644
--- a/infrastructure/modules/lambda_alarms/variable.tf
+++ b/infrastructure/modules/lambda_alarms/variable.tf
@@ -10,10 +10,6 @@ variable "lambda_function_name" {
type = string
}
-variable "lambda_name" {
- description = "Short identifier used in CloudWatch alarm naming."
- type = string
-}
variable "alarm_actions" {
description = "List of ARNs (e.g., SNS topics) to notify when a CloudWatch alarm is triggered."
type = list(string)