From c7f65a03b092000ac19778564cc3faf5e0997f7e Mon Sep 17 00:00:00 2001 From: mamari90 <130982006+mamari90@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:47:58 +0100 Subject: [PATCH] added printit rg --- .../01_app_service_pdf_engine_clone.tf | 48 +++++++++++-------- src/domains/printit-app/README.md | 1 + .../shared-app/01_app_service_pdf_engine.tf | 6 +-- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/domains/printit-app/01_app_service_pdf_engine_clone.tf b/src/domains/printit-app/01_app_service_pdf_engine_clone.tf index e6733c497..9854bfc53 100644 --- a/src/domains/printit-app/01_app_service_pdf_engine_clone.tf +++ b/src/domains/printit-app/01_app_service_pdf_engine_clone.tf @@ -1,3 +1,11 @@ +resource "azurerm_resource_group" "printit_pdf_engine_app_service_rg_clone" { + count = var.is_feature_enabled.pdf_engine_clone ? 1 : 0 + name = "${local.project}-pdf-engine-clone-rg" + location = var.location + + tags = var.tags +} + ################ # node ################ @@ -8,7 +16,7 @@ module "printit_pdf_engine_app_service_clone" { count = var.is_feature_enabled.pdf_engine_clone ? 1 : 0 vnet_integration = false - resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name + resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name location = var.location # App service plan vars @@ -52,7 +60,7 @@ module "printit_pdf_engine_slot_staging_clone" { # App service name = "staging" - resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name + resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name location = var.location always_on = true @@ -78,8 +86,8 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ enabled = var.app_service_pdf_engine_autoscale_enabled name = "${local.project}-autoscale-pdf-engine-clone" - resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name - location = azurerm_resource_group.printit_pdf_engine_app_service_rg.location + resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name + location = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].location target_resource_id = module.printit_pdf_engine_app_service_clone[0].plan_id profile { @@ -95,7 +103,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "Requests" - metric_resource_id = module.printit_pdf_engine_app_service[0].id + metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -117,7 +125,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "Requests" - metric_resource_id = module.printit_pdf_engine_app_service[0].id + metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -143,7 +151,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "HttpResponseTime" - metric_resource_id = module.printit_pdf_engine_app_service[0].id + metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -165,7 +173,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "HttpResponseTime" - metric_resource_id = module.printit_pdf_engine_app_service[0].id + metric_resource_id = module.printit_pdf_engine_app_service_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -191,7 +199,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "CpuPercentage" - metric_resource_id = module.printit_pdf_engine_app_service[0].plan_id + metric_resource_id = module.printit_pdf_engine_app_service_clone[0].plan_id metric_namespace = "microsoft.web/serverfarms" time_grain = "PT1M" statistic = "Average" @@ -213,7 +221,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "CpuPercentage" - metric_resource_id = module.printit_pdf_engine_app_service[0].plan_id + metric_resource_id = module.printit_pdf_engine_app_service_clone[0].plan_id metric_namespace = "microsoft.web/serverfarms" time_grain = "PT1M" statistic = "Average" @@ -245,7 +253,7 @@ module "printit_pdf_engine_app_service_java_clone" { count = var.is_feature_enabled.pdf_engine_clone ? 1 : 0 vnet_integration = false - resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name + resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name location = var.location # App service plan vars @@ -287,7 +295,7 @@ module "printit_pdf_engine_java_slot_staging_clone" { # App service name = "staging" - resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name + resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name location = var.location always_on = true @@ -313,8 +321,8 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ name = "${local.project}-autoscale-pdf-engine-java-clone" - resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg.name - location = azurerm_resource_group.printit_pdf_engine_app_service_rg.location + resource_group_name = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].name + location = azurerm_resource_group.printit_pdf_engine_app_service_rg_clone[0].location target_resource_id = module.printit_pdf_engine_app_service_java_clone[0].plan_id enabled = var.app_service_pdf_engine_autoscale_enabled @@ -331,7 +339,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "Requests" - metric_resource_id = module.printit_pdf_engine_app_service_java[0].id + metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -353,7 +361,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "Requests" - metric_resource_id = module.printit_pdf_engine_app_service_java[0].id + metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -379,7 +387,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "HttpResponseTime" - metric_resource_id = module.printit_pdf_engine_app_service_java[0].id + metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -401,7 +409,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "HttpResponseTime" - metric_resource_id = module.printit_pdf_engine_app_service_java[0].id + metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].id metric_namespace = "microsoft.web/sites" time_grain = "PT1M" statistic = "Average" @@ -427,7 +435,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "CpuPercentage" - metric_resource_id = module.printit_pdf_engine_app_service_java[0].plan_id + metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].plan_id metric_namespace = "microsoft.web/serverfarms" time_grain = "PT1M" statistic = "Average" @@ -449,7 +457,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_printit_pdf_ rule { metric_trigger { metric_name = "CpuPercentage" - metric_resource_id = module.printit_pdf_engine_app_service_java[0].plan_id + metric_resource_id = module.printit_pdf_engine_app_service_java_clone[0].plan_id metric_namespace = "microsoft.web/serverfarms" time_grain = "PT1M" statistic = "Average" diff --git a/src/domains/printit-app/README.md b/src/domains/printit-app/README.md index 3bc33f63e..3efa080e8 100644 --- a/src/domains/printit-app/README.md +++ b/src/domains/printit-app/README.md @@ -206,6 +206,7 @@ No outputs. | [azurerm_monitor_scheduled_query_rules_alert.print-notice-retry-fn-error-alert](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource | | [azurerm_private_dns_a_record.ingress](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_dns_a_record) | resource | | [azurerm_resource_group.printit_pdf_engine_app_service_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource | +| [azurerm_resource_group.printit_pdf_engine_app_service_rg_clone](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource | | [helm_release.cert_mounter](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.reloader](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [kubernetes_namespace.namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | diff --git a/src/domains/shared-app/01_app_service_pdf_engine.tf b/src/domains/shared-app/01_app_service_pdf_engine.tf index 05db95584..d5d02d01d 100644 --- a/src/domains/shared-app/01_app_service_pdf_engine.tf +++ b/src/domains/shared-app/01_app_service_pdf_engine.tf @@ -114,9 +114,9 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_shared_pdf_e name = "default" capacity { - default = 1 - minimum = 1 - maximum = 1 + default = var.env_short == "p" ? 3 : 1 + minimum = var.env_short == "p" ? 3 : 1 + maximum = var.env_short == "p" ? 12 : 1 } # Requests