Skip to content

Commit

Permalink
Add canonical hostname variable
Browse files Browse the repository at this point in the history
  • Loading branch information
AbigailMcP committed May 22, 2024
1 parent 78baf7b commit 087f7b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion terraform/application/application.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions terraform/application/config/production.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion terraform/application/config/test.tfvars.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cluster": "test",
"namespace": "srtl-test",
"environment": "test"
"environment": "test",
"canonical_hostname": "claim-additional-payments-for-teaching-test.test.teacherservices.cloud"
}
7 changes: 7 additions & 0 deletions terraform/application/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 087f7b7

Please sign in to comment.