-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda-search-document-review.tf
More file actions
68 lines (64 loc) · 2.63 KB
/
lambda-search-document-review.tf
File metadata and controls
68 lines (64 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
module "search_document_review_lambda" {
source = "./modules/lambda"
name = "SearchDocumentReview"
handler = "handlers.search_document_review_handler.lambda_handler"
iam_role_policy_documents = [
module.ndr-app-config.app_config_policy,
module.document_upload_review_dynamodb_table.dynamodb_read_policy_document,
aws_iam_policy.ssm_access_policy.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
http_methods = ["GET"]
resource_id = module.review_document_gateway.gateway_resource_id
kms_deletion_window = var.kms_deletion_window
is_gateway_integration_needed = true
is_invoked_from_gateway = true
lambda_environment_variables = {
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
DOCUMENT_REVIEW_DYNAMODB_NAME = module.document_upload_review_dynamodb_table.table_name
WORKSPACE = terraform.workspace
PDS_FHIR_IS_STUBBED = local.is_sandbox
}
depends_on = [
aws_api_gateway_rest_api.ndr_doc_store_api,
module.review_document_gateway
]
}
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
namespace = "AWS/Lambda"
alarm_actions = [module.search_document_review_lambda_alarm_topic.arn]
ok_actions = [module.search_document_review_lambda_alarm_topic.arn]
}
module "search_document_review_lambda_alarm_topic" {
source = "./modules/sns"
sns_encryption_key_id = module.sns_encryption_key.id
topic_name = "search-document-review-lambda-alarm-topic"
topic_protocol = "lambda"
topic_endpoint = module.search_document_review_lambda.lambda_arn
delivery_policy = jsonencode({
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Principal" : {
"Service" : "cloudwatch.amazonaws.com"
},
"Action" : [
"SNS:Publish",
],
"Condition" : {
"ArnLike" : {
"aws:SourceArn" : "arn:aws:cloudwatch:eu-west-2:${data.aws_caller_identity.current.account_id}:alarm:*"
}
}
"Resource" : "*"
}
]
})
}