Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Paymcloud 152 printit mono az #2647

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
480 changes: 480 additions & 0 deletions src/domains/printit-app/01_app_service_pdf_engine_clone.tf

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/domains/printit-app/04_apim_pdf_engine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ locals {
description = "PDF Engine Service for Stampa Avvisi - API"
path = "printit/pdf-engine"
subscription_required = true
service_url = can(module.printit_pdf_engine_app_service_java[0].default_site_hostname) ? module.printit_pdf_engine_app_service_java[0].default_site_hostname : ""
service_url = var.is_feature_enabled.apim_use_pdf_engine_clone ? (can(module.printit_pdf_engine_app_service_java_clone[0].default_site_hostname) ? module.printit_pdf_engine_app_service_java_clone[0].default_site_hostname : "") : (can(module.printit_pdf_engine_app_service_java[0].default_site_hostname) ? module.printit_pdf_engine_app_service_java[0].default_site_hostname : "")
}
apim_pdf_engine_node_service_api = {
# node
display_name = "PDF Engine Node Service for Stampa Avvisi - API"
description = "PDF Engine Node Service for Stampa Avvisi - API"
path = "printit/pdf-engine-node"
subscription_required = true
service_url = can(module.printit_pdf_engine_app_service[0].default_site_hostname) ? module.printit_pdf_engine_app_service[0].default_site_hostname : ""
service_url = var.is_feature_enabled.apim_use_pdf_engine_clone ? (can(module.printit_pdf_engine_app_service_clone[0].default_site_hostname) ? module.printit_pdf_engine_app_service_clone[0].default_site_hostname : "") : (can(module.printit_pdf_engine_app_service[0].default_site_hostname) ? module.printit_pdf_engine_app_service[0].default_site_hostname : "")
}
}

Expand Down
13 changes: 9 additions & 4 deletions src/domains/printit-app/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ variable "tags" {

variable "is_feature_enabled" {
type = object({
pdf_engine = bool
printit = bool
pdf_engine = bool
printit = bool
apim_use_pdf_engine_clone = optional(bool, false)
pdf_engine_clone = optional(bool, false)
})
default = {
pdf_engine = false
printit = false
pdf_engine = false
printit = false
apim_use_pdf_engine_clone = false
pdf_engine_clone = false
}
}
### External resources
Expand Down Expand Up @@ -223,3 +227,4 @@ variable "app_service_ip_restriction_default_action" {
default = "Allow"
description = "(Optional) The Default action for traffic that does not match any ip_restriction rule. possible values include Allow and Deny. Defaults to Allow."
}

9 changes: 8 additions & 1 deletion src/domains/printit-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ No outputs.
| <a name="module_kubernetes_service_account"></a> [kubernetes\_service\_account](#module\_kubernetes\_service\_account) | ./.terraform/modules/__v3__/kubernetes_service_account | n/a |
| <a name="module_pod_identity"></a> [pod\_identity](#module\_pod\_identity) | ./.terraform/modules/__v3__/kubernetes_pod_identity | n/a |
| <a name="module_printit_pdf_engine_app_service"></a> [printit\_pdf\_engine\_app\_service](#module\_printit\_pdf\_engine\_app\_service) | ./.terraform/modules/__v3__/app_service | n/a |
| <a name="module_printit_pdf_engine_app_service_clone"></a> [printit\_pdf\_engine\_app\_service\_clone](#module\_printit\_pdf\_engine\_app\_service\_clone) | ./.terraform/modules/__v3__/app_service | n/a |
| <a name="module_printit_pdf_engine_app_service_java"></a> [printit\_pdf\_engine\_app\_service\_java](#module\_printit\_pdf\_engine\_app\_service\_java) | ./.terraform/modules/__v3__/app_service | n/a |
| <a name="module_printit_pdf_engine_app_service_java_clone"></a> [printit\_pdf\_engine\_app\_service\_java\_clone](#module\_printit\_pdf\_engine\_app\_service\_java\_clone) | ./.terraform/modules/__v3__/app_service | n/a |
| <a name="module_printit_pdf_engine_java_slot_staging"></a> [printit\_pdf\_engine\_java\_slot\_staging](#module\_printit\_pdf\_engine\_java\_slot\_staging) | ./.terraform/modules/__v3__/app_service_slot | n/a |
| <a name="module_printit_pdf_engine_java_slot_staging_clone"></a> [printit\_pdf\_engine\_java\_slot\_staging\_clone](#module\_printit\_pdf\_engine\_java\_slot\_staging\_clone) | ./.terraform/modules/__v3__/app_service_slot | n/a |
| <a name="module_printit_pdf_engine_slot_staging"></a> [printit\_pdf\_engine\_slot\_staging](#module\_printit\_pdf\_engine\_slot\_staging) | ./.terraform/modules/__v3__/app_service_slot | n/a |
| <a name="module_printit_pdf_engine_slot_staging_clone"></a> [printit\_pdf\_engine\_slot\_staging\_clone](#module\_printit\_pdf\_engine\_slot\_staging\_clone) | ./.terraform/modules/__v3__/app_service_slot | n/a |
| <a name="module_tls_checker"></a> [tls\_checker](#module\_tls\_checker) | ./.terraform/modules/__v3__/tls_checker | n/a |

## Resources
Expand Down Expand Up @@ -186,7 +190,9 @@ No outputs.
| [azurerm_key_vault_secret.templates_storage_account_pkey](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
| [azurerm_key_vault_secret.tenant_id](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
| [azurerm_monitor_autoscale_setting.autoscale_app_service_printit_pdf_engine_autoscale](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_autoscale_setting) | resource |
| [azurerm_monitor_autoscale_setting.autoscale_app_service_printit_pdf_engine_autoscale_clone](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_autoscale_setting) | resource |
| [azurerm_monitor_autoscale_setting.autoscale_app_service_printit_pdf_engine_java_autoscale](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_autoscale_setting) | resource |
| [azurerm_monitor_autoscale_setting.autoscale_app_service_printit_pdf_engine_java_autoscale_clone](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_autoscale_setting) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.generate-pdf-engine-generate-responsetime](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.pagopa-pdf-engine-pdf-availability](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.pagopa-print-payment-notice-generator-responsetime-upd](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
Expand All @@ -200,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 |
Expand Down Expand Up @@ -255,7 +262,7 @@ No outputs.
| <a name="input_ingress_load_balancer_ip"></a> [ingress\_load\_balancer\_ip](#input\_ingress\_load\_balancer\_ip) | ## Aks | `string` | n/a | yes |
| <a name="input_instance"></a> [instance](#input\_instance) | One of beta, prod01, prod02 | `string` | n/a | yes |
| <a name="input_io_backend_base_path"></a> [io\_backend\_base\_path](#input\_io\_backend\_base\_path) | io backend api base path | `string` | `null` | no |
| <a name="input_is_feature_enabled"></a> [is\_feature\_enabled](#input\_is\_feature\_enabled) | n/a | <pre>object({<br/> pdf_engine = bool<br/> printit = bool<br/> })</pre> | <pre>{<br/> "pdf_engine": false,<br/> "printit": false<br/>}</pre> | no |
| <a name="input_is_feature_enabled"></a> [is\_feature\_enabled](#input\_is\_feature\_enabled) | n/a | <pre>object({<br/> pdf_engine = bool<br/> printit = bool<br/> apim_use_pdf_engine_clone = optional(bool, false)<br/> pdf_engine_clone = optional(bool, false)<br/> })</pre> | <pre>{<br/> "apim_use_pdf_engine_clone": false,<br/> "pdf_engine": false,<br/> "pdf_engine_clone": false,<br/> "printit": false<br/>}</pre> | no |
| <a name="input_k8s_kube_config_path_prefix"></a> [k8s\_kube\_config\_path\_prefix](#input\_k8s\_kube\_config\_path\_prefix) | n/a | `string` | `"~/.kube"` | no |
| <a name="input_location"></a> [location](#input\_location) | One of westeurope, northeurope | `string` | n/a | yes |
| <a name="input_location_short"></a> [location\_short](#input\_location\_short) | One of wue, neu | `string` | n/a | yes |
Expand Down
6 changes: 4 additions & 2 deletions src/domains/printit-app/env/itn-prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ ingress_load_balancer_ip = "10.3.2.250"

# pdf-engine
is_feature_enabled = {
pdf_engine = true
printit = true
pdf_engine = true
pdf_engine_clone = true
printit = true
apim_use_pdf_engine_clone = false
}

app_service_pdf_engine_sku_name = "P2v3"
Expand Down
20 changes: 10 additions & 10 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 All @@ -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
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
Loading