Skip to content

Commit f24bb97

Browse files
committed
[NDR-28] new search document ref lambda
1 parent a54a39b commit f24bb97

File tree

11 files changed

+73
-10
lines changed

11 files changed

+73
-10
lines changed

infrastructure/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
| <a name="module_cloudfront-distribution-lg"></a> [cloudfront-distribution-lg](#module\_cloudfront-distribution-lg) | ./modules/cloudfront | n/a |
4444
| <a name="module_cloudfront_edge_dynamodb_table"></a> [cloudfront\_edge\_dynamodb\_table](#module\_cloudfront\_edge\_dynamodb\_table) | ./modules/dynamo_db | n/a |
4545
| <a name="module_cloudfront_firewall_waf_v2"></a> [cloudfront\_firewall\_waf\_v2](#module\_cloudfront\_firewall\_waf\_v2) | ./modules/firewall_waf_v2 | n/a |
46-
| <a name="module_create-doc-ref-gateway"></a> [create-doc-ref-gateway](#module\_create-doc-ref-gateway) | ./modules/gateway | n/a |
4746
| <a name="module_create-doc-ref-lambda"></a> [create-doc-ref-lambda](#module\_create-doc-ref-lambda) | ./modules/lambda | n/a |
4847
| <a name="module_create-token-gateway"></a> [create-token-gateway](#module\_create-token-gateway) | ./modules/gateway | n/a |
4948
| <a name="module_create-token-lambda"></a> [create-token-lambda](#module\_create-token-lambda) | ./modules/lambda | n/a |
@@ -66,6 +65,7 @@
6665
| <a name="module_document_manifest_alarm"></a> [document\_manifest\_alarm](#module\_document\_manifest\_alarm) | ./modules/lambda_alarms | n/a |
6766
| <a name="module_document_manifest_alarm_topic"></a> [document\_manifest\_alarm\_topic](#module\_document\_manifest\_alarm\_topic) | ./modules/sns | n/a |
6867
| <a name="module_document_reference_dynamodb_table"></a> [document\_reference\_dynamodb\_table](#module\_document\_reference\_dynamodb\_table) | ./modules/dynamo_db | n/a |
68+
| <a name="module_document_reference_gateway"></a> [document\_reference\_gateway](#module\_document\_reference\_gateway) | ./modules/gateway | n/a |
6969
| <a name="module_edge-presign-lambda"></a> [edge-presign-lambda](#module\_edge-presign-lambda) | ./modules/lambda_edge | n/a |
7070
| <a name="module_edge_presign_alarm"></a> [edge\_presign\_alarm](#module\_edge\_presign\_alarm) | ./modules/lambda_alarms | n/a |
7171
| <a name="module_edge_presign_alarm_topic"></a> [edge\_presign\_alarm\_topic](#module\_edge\_presign\_alarm\_topic) | ./modules/sns | n/a |
@@ -127,6 +127,7 @@
127127
| <a name="module_pdf-stitching-lambda"></a> [pdf-stitching-lambda](#module\_pdf-stitching-lambda) | ./modules/lambda | n/a |
128128
| <a name="module_pdf-stitching-lambda-alarms"></a> [pdf-stitching-lambda-alarms](#module\_pdf-stitching-lambda-alarms) | ./modules/lambda_alarms | n/a |
129129
| <a name="module_route53_fargate_ui"></a> [route53\_fargate\_ui](#module\_route53\_fargate\_ui) | ./modules/route53 | n/a |
130+
| <a name="module_search-document-references-fhir-lambda"></a> [search-document-references-fhir-lambda](#module\_search-document-references-fhir-lambda) | ./modules/lambda | n/a |
130131
| <a name="module_search-document-references-gateway"></a> [search-document-references-gateway](#module\_search-document-references-gateway) | ./modules/gateway | n/a |
131132
| <a name="module_search-document-references-lambda"></a> [search-document-references-lambda](#module\_search-document-references-lambda) | ./modules/lambda | n/a |
132133
| <a name="module_search-patient-details-gateway"></a> [search-patient-details-gateway](#module\_search-patient-details-gateway) | ./modules/gateway | n/a |
@@ -185,6 +186,7 @@
185186
| [aws_api_gateway_integration_response.get_document_reference_mock_403_response](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_integration_response) | resource |
186187
| [aws_api_gateway_integration_response.get_document_reference_mock_404_response](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_integration_response) | resource |
187188
| [aws_api_gateway_method.get_document_reference](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method) | resource |
189+
| [aws_api_gateway_method.get_document_references_fhir](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method) | resource |
188190
| [aws_api_gateway_method.login_proxy_method](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method) | resource |
189191
| [aws_api_gateway_method.sandbox_get_document_reference](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method) | resource |
190192
| [aws_api_gateway_method_response.response_200](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_method_response) | resource |
@@ -346,6 +348,7 @@
346348
| Name | Description | Type | Default | Required |
347349
|------|-------------|------|---------|:--------:|
348350
| <a name="input_access_audit_dynamodb_table_name"></a> [access\_audit\_dynamodb\_table\_name](#input\_access\_audit\_dynamodb\_table\_name) | The name of the dynamodb table to store the audit of access to deceased patient records | `string` | `"AccessAudit"` | no |
351+
| <a name="input_apim_environment"></a> [apim\_environment](#input\_apim\_environment) | n/a | `any` | n/a | yes |
349352
| <a name="input_auth_session_dynamodb_table_name"></a> [auth\_session\_dynamodb\_table\_name](#input\_auth\_session\_dynamodb\_table\_name) | The name of the dynamodb table to store user login sessions | `string` | `"AuthSessionReferenceMetadata"` | no |
350353
| <a name="input_auth_state_dynamodb_table_name"></a> [auth\_state\_dynamodb\_table\_name](#input\_auth\_state\_dynamodb\_table\_name) | The name of the dynamodb table to store the state values (for CIS2 authorisation) | `string` | `"AuthStateReferenceMetadata"` | no |
351354
| <a name="input_availability_zones"></a> [availability\_zones](#input\_availability\_zones) | This is a list that specifies all the Availability Zones that will have a pair of public and private subnets | `list(string)` | <pre>[<br/> "eu-west-2a",<br/> "eu-west-2b",<br/> "eu-west-2c"<br/>]</pre> | no |

infrastructure/api.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ resource "aws_api_gateway_deployment" "ndr_api_deploy" {
4747
module.access-audit-lambda,
4848
module.back-channel-logout-gateway,
4949
module.back_channel_logout_lambda,
50-
module.create-doc-ref-gateway,
50+
module.document_reference_gateway,
5151
module.create-doc-ref-lambda,
5252
module.create-token-gateway,
5353
module.create-token-lambda,

infrastructure/dev.tfvars

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ cloudwatch_alarm_evaluation_periods = 5
88
poll_frequency = "3600"
99

1010
standalone_vpc_tag = "ndr-dev"
11-
standalone_vpc_ig_tag = "ndr-dev"
11+
standalone_vpc_ig_tag = "ndr-dev"
12+
13+
apim_environment = "internal-dev."

infrastructure/lambda-create-doc-ref.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module "create-doc-ref-gateway" {
1+
module "document_reference_gateway" {
22
source = "./modules/gateway"
33
api_gateway_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
44
parent_id = aws_api_gateway_rest_api.ndr_doc_store_api.root_resource_id
@@ -73,7 +73,7 @@ module "create-doc-ref-lambda" {
7373
module.ndr-app-config.app_config_policy,
7474
]
7575
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
76-
resource_id = module.create-doc-ref-gateway.gateway_resource_id
76+
resource_id = module.document_reference_gateway.gateway_resource_id
7777
http_methods = ["POST"]
7878
memory_size = 512
7979

@@ -96,7 +96,7 @@ module "create-doc-ref-lambda" {
9696
module.document_reference_dynamodb_table,
9797
module.lloyd_george_reference_dynamodb_table,
9898
module.ndr-bulk-staging-store,
99-
module.create-doc-ref-gateway,
99+
module.document_reference_gateway,
100100
module.ndr-app-config,
101101
module.lloyd_george_reference_dynamodb_table,
102102
module.document_reference_dynamodb_table,

infrastructure/lambda-get-document-nrl.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_api_gateway_resource" "get_document_reference" {
22
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
3-
parent_id = module.create-doc-ref-gateway.gateway_resource_id
3+
parent_id = module.document_reference_gateway.gateway_resource_id
44
path_part = "{id}"
55
}
66

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
resource "aws_api_gateway_method" "get_document_references_fhir" {
2+
count = local.is_production ? 0 : 1
3+
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
4+
resource_id = module.document_reference_gateway.gateway_resource_id
5+
http_method = "GET"
6+
authorization = "NONE"
7+
api_key_required = true
8+
}
9+
10+
11+
module "search-document-references-fhir-lambda" {
12+
count = local.is_production ? 0 : 1
13+
source = "./modules/lambda"
14+
name = "SearchDocumentReferencesFHIRLambda"
15+
handler = "handlers.fhir_document_reference_search_handler.lambda_handler"
16+
iam_role_policy_documents = [
17+
module.document_reference_dynamodb_table.dynamodb_read_policy_document,
18+
module.document_reference_dynamodb_table.dynamodb_write_policy_document,
19+
module.lloyd_george_reference_dynamodb_table.dynamodb_read_policy_document,
20+
module.lloyd_george_reference_dynamodb_table.dynamodb_write_policy_document,
21+
module.ndr-lloyd-george-store.s3_read_policy_document,
22+
module.ndr-document-store.s3_read_policy_document,
23+
module.ndr-app-config.app_config_policy
24+
]
25+
rest_api_id = aws_api_gateway_rest_api.ndr_doc_store_api.id
26+
resource_id = module.document_reference_gateway.gateway_resource_id
27+
http_methods = ["GET"]
28+
api_execution_arn = aws_api_gateway_rest_api.ndr_doc_store_api.execution_arn
29+
lambda_environment_variables = {
30+
APPCONFIG_APPLICATION = module.ndr-app-config.app_config_application_id
31+
APPCONFIG_ENVIRONMENT = module.ndr-app-config.app_config_environment_id
32+
APPCONFIG_CONFIGURATION = module.ndr-app-config.app_config_configuration_profile_id
33+
DYNAMODB_TABLE_LIST = "[\u0022${terraform.workspace}_${var.docstore_dynamodb_table_name}\u0022, \u0022${terraform.workspace}_${var.lloyd_george_dynamodb_table_name}\u0022]"
34+
DOCUMENT_RETRIEVE_ENDPOINT_APIM = "${local.apim_api_url}/DocumentReference"
35+
WORKSPACE = terraform.workspace
36+
}
37+
depends_on = [
38+
aws_api_gateway_rest_api.ndr_doc_store_api,
39+
module.search-document-references-gateway,
40+
module.ndr-app-config
41+
]
42+
}

infrastructure/moved-resources.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# PRM-28
2+
3+
moved {
4+
from = module.create-doc-ref-gateway
5+
to = module.document_reference_gateway
6+
}

infrastructure/preprod.tfvars

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ cloudwatch_alarm_evaluation_periods = 30
88
poll_frequency = "60"
99

1010
standalone_vpc_tag = "ndr-pre-prod"
11-
standalone_vpc_ig_tag = "ndr-pre-prod"
11+
standalone_vpc_ig_tag = "ndr-pre-prod"
12+
13+
apim_environment = "int."

infrastructure/prod.tfvars

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ cloudwatch_alarm_evaluation_periods = 30
88
poll_frequency = "60"
99

1010
standalone_vpc_tag = "ndr-prod"
11-
standalone_vpc_ig_tag = "ndr-prod"
11+
standalone_vpc_ig_tag = "ndr-prod"
12+
13+
apim_environment = ""

infrastructure/test.tfvars

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ cloudwatch_alarm_evaluation_periods = 5
88
poll_frequency = "10"
99

1010
standalone_vpc_tag = "ndr-test"
11-
standalone_vpc_ig_tag = "ndr-test"
11+
standalone_vpc_ig_tag = "ndr-test"
12+
13+
apim_environment = "internal-qa."

0 commit comments

Comments
 (0)