From 3423c1c4fa49e3fee55e877ca45fab0e76c2282f Mon Sep 17 00:00:00 2001 From: mamari90 <130982006+mamari90@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:28:52 +0100 Subject: [PATCH] prepared shared pdf engine non-ha --- .../shared-app/01_app_service_pdf_engine.tf | 14 +++++++------- src/domains/shared-app/04_apim_pdf_engine.tf | 4 ++-- src/domains/shared-app/99_variables.tf | 6 ++++++ src/domains/shared-app/README.md | 1 + .../shared-app/env/weu-prod/terraform.tfvars | 1 + 5 files changed, 17 insertions(+), 9 deletions(-) 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 bc42d95a0..05db95584 100644 --- a/src/domains/shared-app/01_app_service_pdf_engine.tf +++ b/src/domains/shared-app/01_app_service_pdf_engine.tf @@ -21,7 +21,7 @@ moved { resource "azurerm_resource_group" "shared_pdf_engine_app_service_rg" { - count = var.env_short != "p" ? 1 : 0 # only DEV and UAT + count = 1 name = format("%s-pdf-engine-rg", local.project) location = var.location @@ -38,7 +38,7 @@ data "azurerm_container_registry" "container_registry" { ################ module "shared_pdf_engine_app_service" { - count = var.env_short != "p" ? 1 : 0 # only DEV and UAT + count = 1 source = "./.terraform/modules/__v3__/app_service" vnet_integration = false @@ -72,7 +72,7 @@ module "shared_pdf_engine_app_service" { } module "shared_pdf_engine_slot_staging" { - count = var.env_short == "u" ? 1 : 0 + count = var.env_short != "d" ? 1 : 0 source = "./.terraform/modules/__v3__/app_service_slot" @@ -102,7 +102,7 @@ module "shared_pdf_engine_slot_staging" { } resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_shared_pdf_engine_autoscale" { - count = var.env_short == "u" ? 1 : 0 + count = var.env_short != "d" ? 1 : 0 name = format("%s-autoscale-pdf-engine", local.project) resource_group_name = azurerm_resource_group.shared_pdf_engine_app_service_rg[0].name @@ -270,7 +270,7 @@ resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_shared_pdf_e ################ module "shared_pdf_engine_app_service_java" { source = "./.terraform/modules/__v3__/app_service" - count = var.env_short != "p" ? 1 : 0 # only DEV and UAT + count = 1 vnet_integration = false resource_group_name = azurerm_resource_group.shared_pdf_engine_app_service_rg[0].name location = var.location @@ -302,7 +302,7 @@ module "shared_pdf_engine_app_service_java" { } module "shared_pdf_engine_java_slot_staging" { - count = var.env_short == "u" ? 1 : 0 + count = var.env_short != "d" ? 1 : 0 source = "./.terraform/modules/__v3__/app_service_slot" @@ -334,7 +334,7 @@ module "shared_pdf_engine_java_slot_staging" { } resource "azurerm_monitor_autoscale_setting" "autoscale_app_service_shared_pdf_engine_java_autoscale" { - count = var.env_short == "u" ? 1 : 0 + count = var.env_short != "d" ? 1 : 0 name = format("%s-autoscale-pdf-engine-java", local.project) resource_group_name = azurerm_resource_group.shared_pdf_engine_app_service_rg[0].name diff --git a/src/domains/shared-app/04_apim_pdf_engine.tf b/src/domains/shared-app/04_apim_pdf_engine.tf index d63397912..3dc81dc9e 100644 --- a/src/domains/shared-app/04_apim_pdf_engine.tf +++ b/src/domains/shared-app/04_apim_pdf_engine.tf @@ -29,14 +29,14 @@ locals { description = "PDF Engine Service pagoPA - API" path = "shared/pdf-engine" subscription_required = true - service_url = var.pdf_engine_app_ha_enabled ? module.shared_pdf_engine_app_service_java_ha[0].default_site_hostname : module.shared_pdf_engine_app_service_java[0].default_site_hostname + service_url = var.apim_use_pdf_engine_app_ha ? module.shared_pdf_engine_app_service_java_ha[0].default_site_hostname : module.shared_pdf_engine_app_service_java[0].default_site_hostname } apim_pdf_engine_node_service_api = { # node display_name = "PDF Engine Node Service pagoPA - API" description = "PDF Engine Node Service pagoPA - API" path = "shared/pdf-engine-node" subscription_required = true - service_url = var.pdf_engine_app_ha_enabled ? module.shared_pdf_engine_app_service_ha[0].default_site_hostname : module.shared_pdf_engine_app_service[0].default_site_hostname + service_url = var.apim_use_pdf_engine_app_ha ? module.shared_pdf_engine_app_service_ha[0].default_site_hostname : module.shared_pdf_engine_app_service[0].default_site_hostname } } diff --git a/src/domains/shared-app/99_variables.tf b/src/domains/shared-app/99_variables.tf index 1a00929ef..d1c5a748c 100644 --- a/src/domains/shared-app/99_variables.tf +++ b/src/domains/shared-app/99_variables.tf @@ -305,6 +305,12 @@ variable "pdf_engine_app_ha_enabled" { description = "(Required) enables the deployment of pdf engine in HA mode" } +variable "apim_use_pdf_engine_app_ha" { + type = bool + description = "(Optional) enables the usage of pdf engine in HA mode" + default = false +} + // wallet session token variable "io_backend_base_path" { type = string diff --git a/src/domains/shared-app/README.md b/src/domains/shared-app/README.md index 2c2f625e8..e1cfb2b61 100644 --- a/src/domains/shared-app/README.md +++ b/src/domains/shared-app/README.md @@ -163,6 +163,7 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [apim\_dns\_zone\_prefix](#input\_apim\_dns\_zone\_prefix) | The dns subdomain for apim. | `string` | `null` | no | +| [apim\_use\_pdf\_engine\_app\_ha](#input\_apim\_use\_pdf\_engine\_app\_ha) | (Optional) enables the usage of pdf engine in HA mode | `bool` | `false` | no | | [app\_service\_pdf\_engine\_always\_on](#input\_app\_service\_pdf\_engine\_always\_on) | Always on property | `bool` | `true` | no | | [app\_service\_pdf\_engine\_autoscale\_enabled](#input\_app\_service\_pdf\_engine\_autoscale\_enabled) | n/a | `bool` | `true` | no | | [app\_service\_pdf\_engine\_sku\_name](#input\_app\_service\_pdf\_engine\_sku\_name) | app service plan size | `string` | `"S1"` | no | diff --git a/src/domains/shared-app/env/weu-prod/terraform.tfvars b/src/domains/shared-app/env/weu-prod/terraform.tfvars index ecba144dd..1010386a0 100644 --- a/src/domains/shared-app/env/weu-prod/terraform.tfvars +++ b/src/domains/shared-app/env/weu-prod/terraform.tfvars @@ -92,6 +92,7 @@ pagopa_shared_toolbox_enabled = false robots_indexed_paths = [] pdf_engine_app_ha_enabled = true pdf_engine_zone_balancing_enabled = true +apim_use_pdf_engine_app_ha = true // wallet session token io_backend_base_path = "https://api-app.io.pagopa.it"