diff --git a/src/domains/eucovidcert/_modules/function_apps/autoscalers.tf b/src/domains/eucovidcert/_modules/function_apps/autoscalers.tf deleted file mode 100644 index b9ea557da..000000000 --- a/src/domains/eucovidcert/_modules/function_apps/autoscalers.tf +++ /dev/null @@ -1,106 +0,0 @@ -resource "azurerm_monitor_autoscale_setting" "function_eucovidcert" { - name = "${module.function_eucovidcert.name}-autoscale" - resource_group_name = var.resource_group_name - location = var.location - target_resource_id = module.function_eucovidcert.app_service_plan_id - - profile { - name = "default" - - capacity { - default = 10 - minimum = 1 - maximum = 20 - } - - rule { - metric_trigger { - metric_name = "Requests" - metric_resource_id = module.function_eucovidcert.id - metric_namespace = "microsoft.web/sites" - time_grain = "PT1M" - statistic = "Average" - time_window = "PT5M" - time_aggregation = "Average" - operator = "GreaterThan" - threshold = 3000 - divide_by_instance_count = false - } - - scale_action { - direction = "Increase" - type = "ChangeCount" - value = "2" - cooldown = "PT5M" - } - } - - rule { - metric_trigger { - metric_name = "CpuPercentage" - metric_resource_id = module.function_eucovidcert.app_service_plan_id - metric_namespace = "microsoft.web/serverfarms" - time_grain = "PT1M" - statistic = "Average" - time_window = "PT5M" - time_aggregation = "Average" - operator = "GreaterThan" - threshold = 45 - divide_by_instance_count = false - } - - scale_action { - direction = "Increase" - type = "ChangeCount" - value = "2" - cooldown = "PT5M" - } - } - - rule { - metric_trigger { - metric_name = "Requests" - metric_resource_id = module.function_eucovidcert.id - metric_namespace = "microsoft.web/sites" - time_grain = "PT1M" - statistic = "Average" - time_window = "PT5M" - time_aggregation = "Average" - operator = "LessThan" - threshold = 2000 - divide_by_instance_count = false - } - - scale_action { - direction = "Decrease" - type = "ChangeCount" - value = "1" - cooldown = "PT20M" - } - } - - rule { - metric_trigger { - metric_name = "CpuPercentage" - metric_resource_id = module.function_eucovidcert.app_service_plan_id - metric_namespace = "microsoft.web/serverfarms" - time_grain = "PT1M" - statistic = "Average" - time_window = "PT5M" - time_aggregation = "Average" - operator = "LessThan" - threshold = 30 - divide_by_instance_count = false - } - - scale_action { - direction = "Decrease" - type = "ChangeCount" - value = "1" - cooldown = "PT20M" - } - } - } - - tags = var.tags -} diff --git a/src/domains/eucovidcert/_modules/function_apps/function_app_eucovidcert.tf b/src/domains/eucovidcert/_modules/function_apps/function_app_eucovidcert.tf index 2a96c4808..376c552e0 100644 --- a/src/domains/eucovidcert/_modules/function_apps/function_app_eucovidcert.tf +++ b/src/domains/eucovidcert/_modules/function_apps/function_app_eucovidcert.tf @@ -14,7 +14,7 @@ module "function_eucovidcert" { app_service_plan_info = { kind = "Linux" - sku_size = "P1v3" + sku_size = "B1" maximum_elastic_worker_count = 0 worker_count = null zone_balancing_enabled = false @@ -46,42 +46,3 @@ module "function_eucovidcert" { tags = var.tags } -module "function_eucovidcert_staging_slot" { - source = "github.com/pagopa/terraform-azurerm-v3//function_app_slot?ref=v7.69.1" - - name = "staging" - location = var.location - resource_group_name = var.resource_group_name - function_app_id = module.function_eucovidcert.id - app_service_plan_id = module.function_eucovidcert.app_service_plan_id - health_check_path = "/api/v1/info" - - storage_account_name = module.function_eucovidcert.storage_account.name - storage_account_access_key = module.function_eucovidcert.storage_account.primary_access_key - - node_version = "14" - always_on = "true" - runtime_version = "~4" - application_insights_instrumentation_key = data.azurerm_application_insights.application_insights.instrumentation_key - - app_settings = merge( - local.function_eucovidcert.app_settings, - { - "AzureWebJobs.NotifyNewProfileToDGC.Disabled" = "1" - } - ) - - subnet_id = var.subnet_id - - allowed_subnets = [ - data.azurerm_subnet.snet_azdoa.id, - var.subnet_id, - data.azurerm_subnet.snet_backendl1.id, - data.azurerm_subnet.snet_backendl2.id, - data.azurerm_subnet.snet_apim_v2.id, - data.azurerm_subnet.snet_backendl3.id, - data.azurerm_subnet.apim_itn_snet.id - ] - - tags = var.tags -}