Skip to content

Commit

Permalink
[#IOPID-2535] Update autoscale shared AppServicePlan citizen auth (#1336
Browse files Browse the repository at this point in the history
)
  • Loading branch information
BurnedMarshal authored Nov 27, 2024
1 parent c87c5b7 commit c4b5012
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/domains/citizen-auth-app/07_data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "azurerm_linux_function_app" "function_web_profile" {
name = format("%s-webprof-func-01", local.short_project_itn)
resource_group_name = format("%s-webprof-rg-01", local.short_project_itn)
}
44 changes: 44 additions & 0 deletions src/domains/citizen-auth-app/10_function_public.tf
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,28 @@ resource "azurerm_monitor_autoscale_setting" "function_public_itn" {
}
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = data.azurerm_linux_function_app.function_web_profile.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"
Expand Down Expand Up @@ -194,6 +216,28 @@ resource "azurerm_monitor_autoscale_setting" "function_public_itn" {
}
}

rule {
metric_trigger {
metric_name = "Requests"
metric_resource_id = data.azurerm_linux_function_app.function_web_profile.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"
Expand Down
1 change: 1 addition & 0 deletions src/domains/citizen-auth-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
| [azurerm_key_vault_secret.session_manager_JWT_ZENDESK_SUPPORT_TOKEN_SECRET](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source |
| [azurerm_key_vault_secret.session_manager_TEST_LOGIN_PASSWORD](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source |
| [azurerm_key_vault_secret.session_manager_UNIQUE_EMAIL_ENFORCEMENT_USER](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source |
| [azurerm_linux_function_app.function_web_profile](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.itn_auth_lv_func](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_log_analytics_workspace.log_analytics](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/log_analytics_workspace) | data source |
| [azurerm_monitor_action_group.email](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/monitor_action_group) | data source |
Expand Down

0 comments on commit c4b5012

Please sign in to comment.