Skip to content

Commit ce6975e

Browse files
Merge pull request #728 from NHSDigital/DTOSS-11566-upgrade-postgress-sku
[DTOSS-11566] - Upgrades PostgreSQL SKU and enable high availability.
2 parents 57e491d + ad83a11 commit ce6975e

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

infrastructure/environments/prod/variables.tfvars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ fetch_secrets_from_app_key_vault = true
44
front_door_profile = "afd-live-hub-manbrs"
55
postgres_backup_retention_days = 7
66
postgres_geo_redundant_backup_enabled = true
7+
postgres_sku_name = "GP_Standard_D2ds_v5"
8+
postgres_enable_high_availability = true
79
protect_keyvault = true
810
vnet_address_space = "10.11.0.0/16"
911
nhs_notify_api_message_batch_url = "https://api.service.nhs.uk/comms/v1/message-batches"

infrastructure/modules/container-apps/alerts.tf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
resource "azurerm_monitor_scheduled_query_rules_alert_v2" "failure_event" {
22
count = var.enable_alerting ? 1 : 0
33

4-
auto_mitigation_enabled = false
5-
description = "An alert triggered by a custom event batch_marked_as_failed logged in code"
6-
enabled = var.enable_alerting
7-
evaluation_frequency = "PT5M"
8-
location = var.region
9-
name = "${var.app_short_name}-batch-failed-alert"
10-
resource_group_name = azurerm_resource_group.main.name
11-
scopes = [var.app_insights_id]
12-
severity = 2
13-
skip_query_validation = false
14-
target_resource_types = ["microsoft.insights/components"]
15-
window_duration = "PT5M"
16-
workspace_alerts_storage_enabled = false
4+
auto_mitigation_enabled = false
5+
description = "An alert triggered by a custom event batch_marked_as_failed logged in code"
6+
enabled = var.enable_alerting
7+
evaluation_frequency = "PT5M"
8+
location = var.region
9+
name = "${var.app_short_name}-batch-failed-alert"
10+
resource_group_name = azurerm_resource_group.main.name
11+
scopes = [var.app_insights_id]
12+
severity = 2
13+
skip_query_validation = false
14+
target_resource_types = ["microsoft.insights/components"]
15+
window_duration = "PT5M"
16+
workspace_alerts_storage_enabled = false
1717

1818
action {
19-
action_groups = [var.action_group_id]
19+
action_groups = [var.action_group_id]
2020
}
2121

2222
criteria {

infrastructure/modules/container-apps/postgres.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module "postgres" {
1818

1919
backup_retention_days = var.postgres_backup_retention_days
2020
geo_redundant_backup_enabled = var.postgres_geo_redundant_backup_enabled
21+
enable_high_availability = var.postgres_enable_high_availability
2122
postgresql_admin_object_id = data.azuread_group.postgres_sql_admin_group.object_id
2223
postgresql_admin_principal_name = var.postgres_sql_admin_group
2324
postgresql_admin_principal_type = "Group"

infrastructure/modules/container-apps/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ variable "postgres_subnet_id" {
130130
type = string
131131
}
132132

133+
variable "postgres_enable_high_availability" {
134+
description = "Whether to enable high availability for the PostgreSQL Flexible Server."
135+
type = bool
136+
}
137+
133138
variable "main_subnet_id" {
134139
description = "The main subnet id. Created in the infra module."
135140
type = string

infrastructure/terraform/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module "container-apps" {
6565
postgres_storage_mb = var.postgres_storage_mb
6666
postgres_storage_tier = var.postgres_storage_tier
6767
postgres_subnet_id = var.deploy_infra ? module.infra[0].postgres_subnet_id : data.azurerm_subnet.postgres[0].id
68+
postgres_enable_high_availability = var.postgres_enable_high_availability
6869
main_subnet_id = var.deploy_infra ? module.infra[0].main_subnet_id : data.azurerm_subnet.main[0].id
6970
run_notifications_smoke_test = var.run_notifications_smoke_test
7071
seed_demo_data = var.seed_demo_data

infrastructure/terraform/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ variable "postgres_storage_tier" {
102102
type = string
103103
}
104104

105+
variable "postgres_enable_high_availability" {
106+
description = "Whether to enable high availability for the PostgreSQL Flexible Server."
107+
type = bool
108+
default = false
109+
}
110+
105111
variable "enable_entra_id_authentication" {
106112
description = <<EOT
107113
Enable Entra ID authentication for the container app. If true, authentication will be required to access the application.

0 commit comments

Comments
 (0)