diff --git a/infra/container_apps/user-group-ms/env/uat-pnpg/terraform.tfvars b/infra/container_apps/user-group-ms/env/uat-pnpg/terraform.tfvars index 6fc2c68d..50a03a22 100644 --- a/infra/container_apps/user-group-ms/env/uat-pnpg/terraform.tfvars +++ b/infra/container_apps/user-group-ms/env/uat-pnpg/terraform.tfvars @@ -43,3 +43,7 @@ secrets_names = { "MONGODB_CONNECTION_URI" = "mongodb-connection-string" "JWT_TOKEN_PUBLIC_KEY" = "jwt-public-key" } + +autoscale_settings = [{ + max_throughput = 1000 +}] diff --git a/infra/container_apps/user-group-ms/mongo_db.tf b/infra/container_apps/user-group-ms/mongo_db.tf index 8a7f93f9..957e31ed 100644 --- a/infra/container_apps/user-group-ms/mongo_db.tf +++ b/infra/container_apps/user-group-ms/mongo_db.tf @@ -2,6 +2,13 @@ resource "azurerm_cosmosdb_mongo_database" "selc_user_group" { name = "selcUserGroup" resource_group_name = local.mongo_db.mongodb_rg_name account_name = local.mongo_db.cosmosdb_account_mongodb_name + + dynamic "autoscale_settings" { + for_each = var.autoscale_settings + content { + max_throughput = autoscale_settings.value.max_throughput + } + } } resource "azurerm_management_lock" "mongodb_selc_user_group" { diff --git a/infra/container_apps/user-group-ms/variables.tf b/infra/container_apps/user-group-ms/variables.tf index ee081bc6..a964fc1b 100644 --- a/infra/container_apps/user-group-ms/variables.tf +++ b/infra/container_apps/user-group-ms/variables.tf @@ -73,3 +73,11 @@ variable "suffix_increment" { description = "Suffix increment Container App Environment name" default = "" } + +variable "autoscale_settings" { + type = list(object({ + max_throughput = number + })) + description = "MongoDB autoscale settings" + default = [] +}