Skip to content

Commit

Permalink
prepared shared pdf engine non-ha
Browse files Browse the repository at this point in the history
  • Loading branch information
mamari90 committed Dec 11, 2024
1 parent 3091f04 commit 3423c1c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/domains/shared-app/01_app_service_pdf_engine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/domains/shared-app/04_apim_pdf_engine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/domains/shared-app/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/domains/shared-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_apim_dns_zone_prefix"></a> [apim\_dns\_zone\_prefix](#input\_apim\_dns\_zone\_prefix) | The dns subdomain for apim. | `string` | `null` | no |
| <a name="input_apim_use_pdf_engine_app_ha"></a> [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 |
| <a name="input_app_service_pdf_engine_always_on"></a> [app\_service\_pdf\_engine\_always\_on](#input\_app\_service\_pdf\_engine\_always\_on) | Always on property | `bool` | `true` | no |
| <a name="input_app_service_pdf_engine_autoscale_enabled"></a> [app\_service\_pdf\_engine\_autoscale\_enabled](#input\_app\_service\_pdf\_engine\_autoscale\_enabled) | n/a | `bool` | `true` | no |
| <a name="input_app_service_pdf_engine_sku_name"></a> [app\_service\_pdf\_engine\_sku\_name](#input\_app\_service\_pdf\_engine\_sku\_name) | app service plan size | `string` | `"S1"` | no |
Expand Down
1 change: 1 addition & 0 deletions src/domains/shared-app/env/weu-prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 3423c1c

Please sign in to comment.