Skip to content

Commit

Permalink
Merge pull request #348 from DFE-Digital/2203-amend-template-external…
Browse files Browse the repository at this point in the history
…-url

[2203] Template external url
  • Loading branch information
saliceti authored Jan 14, 2025
2 parents cbdc41b + 075787e commit a0c18ed
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
12 changes: 5 additions & 7 deletions templates/new_service/terraform/application/application.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ module "application_configuration" {
service_short = var.service_short
config_short = var.config_short
secret_key_vault_short = "app"
config_variables_path = "${path.module}/config/${var.config}.yml"

# Delete for non rails apps
is_rails_application = true

config_variables = merge(
local.environment_variables,
{
ENVIRONMENT_NAME = var.environment
PGSSLMODE = local.postgres_ssl_mode
}
)
config_variables = {
ENVIRONMENT_NAME = var.environment
PGSSLMODE = local.postgres_ssl_mode
}
secret_variables = {
DATABASE_URL = module.postgres.url
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
EXAMPLE_KEY: example value 2
EXTERNAL_URL: "https://development.#DNS_ZONE_NAME#"
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"enable_postgres_backup_storage" : true,
"enable_monitoring": true,
"external_url": "https://#DNS_ZONE_NAME#/healthcheck",
"apex_url": "https://#DNS_ZONE_NAME#",
"statuscake_contact_groups": [282453]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---
EXAMPLE_KEY: example value 3
EXTERNAL_URL: "https://#DNS_ZONE_NAME#"
2 changes: 1 addition & 1 deletion templates/new_service/terraform/application/statuscake.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module "statuscake" {
source = "./vendor/modules/aks//monitoring/statuscake"

uptime_urls = compact([module.web_application.probe_url, var.external_url])
ssl_urls = compact([var.external_url])
ssl_urls = compact([var.apex_url])

contact_groups = var.statuscake_contact_groups
}
11 changes: 7 additions & 4 deletions templates/new_service/terraform/application/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ variable "docker_image" {
variable "external_url" {
type = string
default = null
description = "Healthcheck URL for StatusCake monitoring"
description = "Healthcheck URL for StatusCake uptime monitoring"
}
variable "apex_url" {
type = string
default = null
description = "URL for StatusCake SSL certificate monitoring. Only for DNS zone apex domain."
}
variable "statuscake_contact_groups" {
type = list(any)
Expand All @@ -73,7 +78,5 @@ variable "send_traffic_to_maintenance_page" {
locals {
postgres_ssl_mode = var.enable_postgres_ssl ? "require" : "disable"

environment_variables = yamldecode(file("${path.module}/config/${var.config}.yml"))

external_url = try(local.environment_variables["EXTERNAL_URL"], module.web_application.url)
external_url = try(var.external_url, module.web_application.url)
}

0 comments on commit a0c18ed

Please sign in to comment.