diff --git a/infrastructure/environments/preprod/variables.tfvars b/infrastructure/environments/preprod/variables.tfvars index 89a99b78a..ed7bb6bba 100644 --- a/infrastructure/environments/preprod/variables.tfvars +++ b/infrastructure/environments/preprod/variables.tfvars @@ -13,3 +13,4 @@ seed_demo_data = false allowed_paths = ["/notifications/message-status/create"] enable_alerting = true enable_notifications_jobs_schedule = true +min_replicas = 2 diff --git a/infrastructure/environments/prod/variables.tfvars b/infrastructure/environments/prod/variables.tfvars index 8d8f4162d..92ad87120 100644 --- a/infrastructure/environments/prod/variables.tfvars +++ b/infrastructure/environments/prod/variables.tfvars @@ -14,3 +14,4 @@ enable_alerting = true use_apex_domain = true cae_zone_redundancy_enabled = true enable_notifications_jobs_schedule = true +min_replicas = 2 diff --git a/infrastructure/modules/container-apps/main.tf b/infrastructure/modules/container-apps/main.tf index 99f1f52c3..5cb9a99d8 100644 --- a/infrastructure/modules/container-apps/main.tf +++ b/infrastructure/modules/container-apps/main.tf @@ -46,9 +46,10 @@ module "webapp" { { APPLICATIONINSIGHTS_CONNECTION_STRING = var.app_insights_connection_string }, var.deploy_database_as_container ? { DATABASE_PASSWORD = resource.random_password.admin_password[0].result } : {} ) - is_web_app = true - port = 8000 - probe_path = "/healthcheck" + is_web_app = true + port = 8000 + probe_path = "/healthcheck" + min_replicas = var.min_replicas } diff --git a/infrastructure/modules/container-apps/variables.tf b/infrastructure/modules/container-apps/variables.tf index 3f45b91a9..2ee026483 100644 --- a/infrastructure/modules/container-apps/variables.tf +++ b/infrastructure/modules/container-apps/variables.tf @@ -29,6 +29,11 @@ variable "container_app_environment_id" { type = string } +variable "min_replicas" { + description = "Minimum number of container replicas" + type = number +} + variable "default_domain" { description = "The container app environment default domain" type = string diff --git a/infrastructure/terraform/main.tf b/infrastructure/terraform/main.tf index f96323a75..0d09f3d22 100644 --- a/infrastructure/terraform/main.tf +++ b/infrastructure/terraform/main.tf @@ -81,4 +81,5 @@ module "container-apps" { resource_group_name_infra = local.resource_group_name enable_notifications_jobs_schedule = var.enable_notifications_jobs_schedule queue_length_alert_threshold = var.queue_length_alert_threshold + min_replicas = var.min_replicas } diff --git a/infrastructure/terraform/variables.tf b/infrastructure/terraform/variables.tf index c1a0737da..47be062c7 100644 --- a/infrastructure/terraform/variables.tf +++ b/infrastructure/terraform/variables.tf @@ -16,6 +16,12 @@ variable "deploy_container_apps" { default = true } +variable "min_replicas" { + description = "Minimum number of container replicas" + type = number + default = 1 +} + variable "app_short_name" { description = "Application short name (6 characters)" type = string