diff --git a/src/domains/elt/_modules/function_apps/data.tf b/src/domains/elt/_modules/function_apps/data.tf index 3a53b53b4..b235518db 100644 --- a/src/domains/elt/_modules/function_apps/data.tf +++ b/src/domains/elt/_modules/function_apps/data.tf @@ -142,3 +142,9 @@ data "azurerm_storage_account" "function_elt_internal_storage" { name = module.function_elt.storage_account_internal_function_name resource_group_name = var.resource_group_name } + +# Citizen-auth domain Redis Common +data "azurerm_redis_cache" "ioauth_redis_common_itn" { + name = format("%s-itn-citizen-auth-redis-std-v6", var.project) + resource_group_name = format("%s-itn-citizen-auth-data-rg-01", var.project) +} diff --git a/src/domains/elt/_modules/function_apps/function_app_elt.tf b/src/domains/elt/_modules/function_apps/function_app_elt.tf index 241440363..b7f4ca160 100644 --- a/src/domains/elt/_modules/function_apps/function_app_elt.tf +++ b/src/domains/elt/_modules/function_apps/function_app_elt.tf @@ -105,6 +105,11 @@ locals { # INTERNAL_TEST_FISCAL_CODES = module.tests.users.all + + # REDIS CACHE CONFIG FOR PDV IDs + REDIS_URL = data.azurerm_redis_cache.ioauth_redis_common_itn.hostname + REDIS_PORT = data.azurerm_redis_cache.ioauth_redis_common_itn.ssl_port + REDIS_PASSWORD = data.azurerm_redis_cache.ioauth_redis_common_itn.primary_access_key } } } diff --git a/src/domains/messages-app/10_function_messages_xl.tf b/src/domains/messages-app/10_function_messages_xl.tf index 7b15a5d3f..3f68b9526 100644 --- a/src/domains/messages-app/10_function_messages_xl.tf +++ b/src/domains/messages-app/10_function_messages_xl.tf @@ -617,6 +617,118 @@ resource "azurerm_monitor_autoscale_setting" "app_messages_function_xl" { } } + profile { + name = "wallet_gate0" + + capacity { + minimum = 8 + maximum = 30 + default = 10 + } + + fixed_date { + timezone = "W. Europe Standard Time" + start = "2024-10-15T08:00:00.000Z" + end = "2024-10-15T23:30:00.000Z" + } + + rule { + metric_trigger { + metric_name = "Requests" + metric_resource_id = module.app_messages_function_xl[count.index].id + metric_namespace = "microsoft.web/sites" + time_grain = "PT1M" + statistic = "Max" + time_window = "PT1M" + time_aggregation = "Maximum" + operator = "GreaterThan" + threshold = 3000 + divide_by_instance_count = true + } + + scale_action { + direction = "Increase" + type = "ChangeCount" + value = "2" + cooldown = "PT1M" + } + } + + rule { + metric_trigger { + metric_name = "CpuPercentage" + metric_resource_id = module.app_messages_function_xl[count.index].app_service_plan_id + metric_namespace = "microsoft.web/serverfarms" + time_grain = "PT1M" + statistic = "Max" + time_window = "PT1M" + time_aggregation = "Maximum" + operator = "GreaterThan" + threshold = 40 + divide_by_instance_count = false + } + + scale_action { + direction = "Increase" + type = "ChangeCount" + value = "3" + cooldown = "PT2M" + } + } + + rule { + metric_trigger { + metric_name = "Requests" + metric_resource_id = module.app_messages_function_xl[count.index].id + metric_namespace = "microsoft.web/sites" + time_grain = "PT1M" + statistic = "Average" + time_window = "PT5M" + time_aggregation = "Average" + operator = "LessThan" + threshold = 300 + divide_by_instance_count = true + } + + scale_action { + direction = "Decrease" + type = "ChangeCount" + value = "1" + cooldown = "PT1M" + } + } + + rule { + metric_trigger { + metric_name = "CpuPercentage" + metric_resource_id = module.app_messages_function_xl[count.index].app_service_plan_id + metric_namespace = "microsoft.web/serverfarms" + time_grain = "PT1M" + statistic = "Average" + time_window = "PT5M" + time_aggregation = "Average" + operator = "LessThan" + threshold = 15 + divide_by_instance_count = false + } + + scale_action { + direction = "Decrease" + type = "ChangeCount" + value = "1" + cooldown = "PT2M" + } + } + } + + # profile { + # name = "{\"name\":\"default\",\"for\":\"gate0\"}" + + # capacity { + + # } + # } + tags = var.tags } @@ -624,4 +736,4 @@ resource "azurerm_subnet_nat_gateway_association" "net_gateway_association_subne count = var.app_messages_count nat_gateway_id = data.azurerm_nat_gateway.nat_gateway.id subnet_id = module.app_messages_snet_xl[count.index].id -} \ No newline at end of file +}