Skip to content

Commit e449306

Browse files
committed
[NDR-28] create env var for apim endpoint
1 parent 8e0a959 commit e449306

File tree

7 files changed

+23
-11
lines changed

7 files changed

+23
-11
lines changed

infrastructure/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
| Name | Description | Type | Default | Required |
349349
|------|-------------|------|---------|:--------:|
350350
| <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 |
351352
| <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 |
352353
| <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 |
353354
| <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/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-search-document-references-fhir.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ module "search-document-references-fhir-lambda" {
2727
http_methods = ["GET"]
2828
api_execution_arn = aws_api_gateway_rest_api.ndr_doc_store_api.execution_arn
2929
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 = "https://${aws_api_gateway_base_path_mapping.api_mapping.domain_name}/${aws_api_gateway_resource.get_document_reference.path}"
35-
NRL_API_ENDPOINT = local.is_production ? "https://${var.nrl_api_endpoint_suffix}" : "https://int.${var.nrl_api_endpoint_suffix}"
36-
WORKSPACE = terraform.workspace
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}/${aws_api_gateway_resource.get_document_reference.path}"
35+
WORKSPACE = terraform.workspace
3736
}
3837
depends_on = [
3938
aws_api_gateway_rest_api.ndr_doc_store_api,

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."

infrastructure/variable.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ variable "poll_frequency" {}
177177

178178
variable "cloudwatch_alarm_evaluation_periods" {}
179179

180+
variable "apim_environment" {}
181+
180182
locals {
181183
is_sandbox = contains(["ndra", "ndrb", "ndrc", "ndrd"], terraform.workspace)
182184
is_production = contains(["pre-prod", "prod"], terraform.workspace)
@@ -190,6 +192,8 @@ locals {
190192

191193
current_region = data.aws_region.current.name
192194
current_account_id = data.aws_caller_identity.current.account_id
195+
196+
apim_api_url = "https://${var.apim_environment}api.service.nhs.uk/national-document-repository/"
193197
}
194198

195199
variable "nrl_api_endpoint_suffix" {

0 commit comments

Comments
 (0)