-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlambda-search-patient.tf
More file actions
85 lines (82 loc) · 3.55 KB
/
lambda-search-patient.tf
File metadata and controls
85 lines (82 loc) · 3.55 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
module "search-patient-details-gateway" {
source = "./modules/gateway"
api_gateway_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
parent_id = aws_api_gateway_rest_api.ndr_doc_store_api.root_resource_id
http_methods = ["GET"]
authorization = "CUSTOM"
gateway_path = "SearchPatient"
authorizer_id = aws_api_gateway_authorizer.repo_authoriser.id
require_credentials = true
origin = local.base_url_with_quotes
}
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]
depends_on = [module.search-patient-details-lambda, module.search_patient_alarm_topic]
}
module "search_patient_alarm_topic" {
source = "./modules/sns"
sns_encryption_key_id = module.sns_encryption_key.id
topic_name = "search_patient_details_alarms-topic"
topic_protocol = "email"
is_topic_endpoint_list = true
topic_endpoint_list = local.is_sandbox ? [] : nonsensitive(split(",", data.aws_ssm_parameter.cloud_security_notification_email_list.value))
depends_on = [module.sns_encryption_key]
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" : "*"
}
]
})
}
module "search-patient-details-lambda" {
source = "./modules/lambda"
name = "SearchPatientDetailsLambda"
handler = "handlers.search_patient_details_handler.lambda_handler"
iam_role_policy_documents = [
aws_iam_policy.ssm_access_policy.policy,
module.ndr-app-config.app_config_policy,
module.auth_session_dynamodb_table.dynamodb_write_policy_document,
module.auth_session_dynamodb_table.dynamodb_read_policy_document,
module.user_restriction_table.dynamodb_read_policy_document,
]
kms_deletion_window = var.kms_deletion_window
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
resource_id = module.search-patient-details-gateway.gateway_resource_id
http_methods = ["GET"]
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
SSM_PARAM_JWT_TOKEN_PUBLIC_KEY = "jwt_token_public_key"
PDS_FHIR_IS_STUBBED = local.is_sandbox
WORKSPACE = terraform.workspace
AUTH_SESSION_TABLE_NAME = "${terraform.workspace}_${var.auth_session_dynamodb_table_name}"
RESTRICTIONS_TABLE_NAME = module.user_restriction_table.table_name
}
api_execution_arn = aws_api_gateway_rest_api.ndr_doc_store_api.execution_arn
depends_on = [
aws_api_gateway_rest_api.ndr_doc_store_api,
module.search-patient-details-gateway,
module.ndr-app-config
]
}