diff --git a/infrastructure/gateway-user-restrictions.tf b/infrastructure/gateway-user-restrictions.tf index e8376cf1..c2c04022 100644 --- a/infrastructure/gateway-user-restrictions.tf +++ b/infrastructure/gateway-user-restrictions.tf @@ -7,7 +7,7 @@ module "user_restrictions_gateway" { gateway_path = "UserRestriction" authorizer_id = aws_api_gateway_authorizer.repo_authoriser.id require_credentials = true - origin = contains(["prod"], terraform.workspace) ? "'https://${var.domain}'" : "'https://${terraform.workspace}.${var.domain}'" + origin = local.base_url_with_quotes } module "user_restriction_id_gateway" { @@ -19,7 +19,7 @@ module "user_restriction_id_gateway" { authorization = "CUSTOM" authorizer_id = aws_api_gateway_authorizer.repo_authoriser.id require_credentials = true - origin = contains(["prod"], terraform.workspace) ? "'https://${var.domain}'" : "'https://${terraform.workspace}.${var.domain}'" + origin = local.base_url_with_quotes request_parameters = { "method.request.path.id" = true @@ -35,5 +35,5 @@ module "user_restrictions_user_search_gateway" { authorization = "CUSTOM" authorizer_id = aws_api_gateway_authorizer.repo_authoriser.id require_credentials = true - origin = contains(["prod"], terraform.workspace) ? "'https://${var.domain}'" : "'https://${terraform.workspace}.${var.domain}'" + origin = local.base_url_with_quotes } diff --git a/infrastructure/lambda-get-user-information.tf b/infrastructure/lambda-get-user-information.tf index b4522288..0f965608 100644 --- a/infrastructure/lambda-get-user-information.tf +++ b/infrastructure/lambda-get-user-information.tf @@ -12,10 +12,11 @@ module "get_user_information_lambda" { http_methods = ["GET"] api_execution_arn = aws_api_gateway_rest_api.ndr_doc_store_api.execution_arn 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 - WORKSPACE = terraform.workspace + 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 + WORKSPACE = terraform.workspace + HEALTHCARE_WORKER_API_URL = data.aws_ssm_parameter.healthcare_worker_api_base_url.value } depends_on = [ diff --git a/infrastructure/ssm_parameters_user_restrictions.tf b/infrastructure/ssm_parameters_user_restrictions.tf index 641f985e..727a74b6 100644 --- a/infrastructure/ssm_parameters_user_restrictions.tf +++ b/infrastructure/ssm_parameters_user_restrictions.tf @@ -10,3 +10,6 @@ module "healthcare_worker_api_base_url" { ignore_value_changes = true } +data "aws_ssm_parameter" "healthcare_worker_api_base_url" { + name = "/ndr/${var.shared_infra_workspace}/hcw_api_url" +}