From 03a780302ce5521caf9d791115665e3f70859802 Mon Sep 17 00:00:00 2001 From: Tope Emmanuel Date: Wed, 1 May 2024 16:47:03 +0100 Subject: [PATCH] Added required attributes to postgres WHY: There is a required minimum standard setting for prod postgres HOW: By setting HA, Maintenance window and SKU --- terraform/aks/databases.tf | 50 +++++++++---------- terraform/aks/variables.tf | 9 ++++ .../production.tfvars.json | 7 +++ 3 files changed, 40 insertions(+), 26 deletions(-) diff --git a/terraform/aks/databases.tf b/terraform/aks/databases.tf index a19996b6..5f78892f 100644 --- a/terraform/aks/databases.tf +++ b/terraform/aks/databases.tf @@ -1,37 +1,35 @@ module "postgres" { source = "./vendor/modules/aks//aks/postgres" - namespace = var.namespace - environment = local.environment - azure_resource_prefix = var.azure_resource_prefix - service_name = local.service_name - service_short = var.service_short - config_short = var.config_short - - cluster_configuration_map = module.cluster_data.configuration_map - - use_azure = var.deploy_azure_backing_services - azure_enable_monitoring = var.enable_monitoring - azure_extensions = ["plpgsql", "citext", "uuid-ossp"] - server_version = "14" - - azure_enable_backup_storage = var.azure_enable_backup_storage + namespace = var.namespace + environment = local.environment + azure_resource_prefix = var.azure_resource_prefix + service_name = local.service_name + service_short = var.service_short + config_short = var.config_short + cluster_configuration_map = module.cluster_data.configuration_map + use_azure = var.deploy_azure_backing_services + azure_enable_monitoring = var.enable_monitoring + azure_extensions = ["plpgsql", "citext", "uuid-ossp"] + server_version = "14" + azure_enable_backup_storage = var.azure_enable_backup_storage + azure_sku_name = var.postgres_flexible_server_sku + azure_enable_high_availability = var.postgres_enable_high_availability + azure_maintenance_window = var.azure_maintenance_window } module "redis" { count = var.deploy_redis ? 1 : 0 source = "./vendor/modules/aks//aks/redis" - namespace = var.namespace - environment = local.environment - azure_resource_prefix = var.azure_resource_prefix - service_name = local.service_name - service_short = var.service_short - config_short = var.config_short - + namespace = var.namespace + environment = local.environment + azure_resource_prefix = var.azure_resource_prefix + service_name = local.service_name + service_short = var.service_short + config_short = var.config_short cluster_configuration_map = module.cluster_data.configuration_map - - use_azure = var.deploy_azure_backing_services - azure_enable_monitoring = var.enable_monitoring - azure_patch_schedule = [{ "day_of_week" : "Sunday", "start_hour_utc" : 01 }] + use_azure = var.deploy_azure_backing_services + azure_enable_monitoring = var.enable_monitoring + azure_patch_schedule = [{ "day_of_week" : "Sunday", "start_hour_utc" : 01 }] } diff --git a/terraform/aks/variables.tf b/terraform/aks/variables.tf index 11e3b9f5..1251ce05 100644 --- a/terraform/aks/variables.tf +++ b/terraform/aks/variables.tf @@ -45,6 +45,15 @@ variable "enable_monitoring" { default = false description = "Enable monitoring and alerting" } +variable "postgres_enable_high_availability" { + default = false +} +variable "postgres_flexible_server_sku" { + default = "B_Standard_B1ms" +} +variable "azure_maintenance_window" { + default = null +} variable "enable_postgres_ssl" { default = true diff --git a/terraform/aks/workspace_variables/production.tfvars.json b/terraform/aks/workspace_variables/production.tfvars.json index 0b8546ec..598786ca 100644 --- a/terraform/aks/workspace_variables/production.tfvars.json +++ b/terraform/aks/workspace_variables/production.tfvars.json @@ -8,6 +8,13 @@ "config_short": "pd", "service_short": "faltrn", "app_key_vault": "s189p01-faltrn-pd-app-kv", + "postgres_flexible_server_sku": "GP_Standard_D2ds_v4", + "postgres_enable_high_availability": true, + "azure_maintenance_window": { + "day_of_week": 0, + "start_hour": 3, + "start_minute": 0 + }, "statuscake_alerts": { "alert": { "website_url": [