diff --git a/terraform/application/application.tf b/terraform/application/application.tf index 681d651efe..79b4cbc918 100644 --- a/terraform/application/application.tf +++ b/terraform/application/application.tf @@ -15,7 +15,8 @@ module "application_configuration" { { ENVIRONMENT_NAME = var.environment PGSSLMODE = local.postgres_ssl_mode - }) + CANONICAL_HOSTNAME = local.canonical_hostname + }) secret_variables = { DATABASE_URL = module.postgres.url } diff --git a/terraform/application/config/production.tfvars.json b/terraform/application/config/production.tfvars.json index 25bc897d9a..c91ef09893 100644 --- a/terraform/application/config/production.tfvars.json +++ b/terraform/application/config/production.tfvars.json @@ -2,6 +2,7 @@ "cluster": "production", "namespace": "srtl-production", "environment": "production", + "canonical_hostname": "claim-additional-payments-for-teaching-production.teacherservices.cloud", "enable_postgres_backup_storage": true, "enable_monitoring": true, "external_url": "https://claim-additional-teaching-payment.service.gov.uk/healthcheck", diff --git a/terraform/application/config/test.tfvars.json b/terraform/application/config/test.tfvars.json index b64515add3..3257f5f887 100644 --- a/terraform/application/config/test.tfvars.json +++ b/terraform/application/config/test.tfvars.json @@ -1,5 +1,6 @@ { "cluster": "test", "namespace": "srtl-test", - "environment": "test" + "environment": "test", + "canonical_hostname": "claim-additional-payments-for-teaching-test.test.teacherservices.cloud" } diff --git a/terraform/application/variables.tf b/terraform/application/variables.tf index f602f3b136..d4d0bfa9e1 100644 --- a/terraform/application/variables.tf +++ b/terraform/application/variables.tf @@ -53,8 +53,15 @@ variable "config" { type = string } +variable "canonical_hostname" { + type = string + description = "External domain name for the app service" + default = null +} + locals { postgres_ssl_mode = var.enable_postgres_ssl ? "require" : "disable" + canonical_hostname = var.canonical_hostname != null ? var.canonical_hostname : "${var.service_name}-${var.environment}.test.teacherservices.cloud" app_env_values_from_yml = yamldecode(file("${path.module}/config/${var.config}_app_env.yml")) app_env_values = merge(local.app_env_values_from_yml) }