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: Add private ip app gateway integration prf #2519

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions src/domains/nodo-app/env/weu-uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ route_aks = [
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.230.9.150"
},
{
# uat aks nodo nexi postgres onprem prf
name = "aks-outbound-to-nexi-postgres-prf-onprem-balancer-1-subnet"
address_prefix = "10.222.214.127/32"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.230.9.150"
},
{
# prf aks nodo nexi postgres onprem prf
name = "aks-outbound-to-nexi-postgres-prf-onprem-balancer-2-subnet"
address_prefix = "10.222.214.128/32"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.230.9.150"
}
]

vmss_zones = ["1"]
Expand Down
17 changes: 17 additions & 0 deletions src/next-core/01_dns_private.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ resource "azurerm_private_dns_a_record" "private_dns_a_record_db_nodo_nexi_postg
records = var.dns_a_reconds_dbnodonexipostgres_prf_ips
}

resource "azurerm_private_dns_a_record" "private_dns_a_record_db_nodo_nexi_postgres_prf_1" {
count = var.env_short == "u" ? 1 : 0
name = "db-postgres-ndp-prf-1"
zone_name = azurerm_private_dns_zone.db_nodo_dns_zone.name
resource_group_name = azurerm_resource_group.data.name
ttl = 60
records = var.dns_a_reconds_dbnodonexipostgres_prf_balancer_1_ips
}

resource "azurerm_private_dns_a_record" "private_dns_a_record_db_nodo_nexi_postgres_prf_2" {
count = var.env_short == "u" ? 1 : 0
name = "db-postgres-ndp-prf-2"
zone_name = azurerm_private_dns_zone.db_nodo_dns_zone.name
resource_group_name = azurerm_resource_group.data.name
ttl = 60
records = var.dns_a_reconds_dbnodonexipostgres_prf_balancer_2_ips
}
### 🔮 Private dns zone: Redis

resource "azurerm_private_dns_zone" "privatelink_redis_cache_windows_net" {
Expand Down
76 changes: 55 additions & 21 deletions src/next-core/04_appgw_integration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ locals {
port = 443
ssl_profile_name = "${local.product_region}-ssl-profile"
firewall_policy_id = null
type = "Private"
certificate = {
name = var.integration_app_gateway_prf_certificate_name
id = var.integration_app_gateway_prf_certificate_name == "" ? null : replace(
Expand All @@ -55,6 +56,52 @@ locals {
}
}

backends = {
apim = {
protocol = "Https"
host = "api.${var.dns_zone_prefix}.${var.external_domain}"
port = 443
ip_addresses = module.apim[0].private_ip_addresses
fqdns = ["api.${var.dns_zone_prefix}.${var.external_domain}."]
probe = "/status-0123456789abcdef"
probe_name = "probe-apim"
request_timeout = 120
pick_host_name_from_backend = false
}
}

backends_prf = {
apimprf = {
protocol = "Https"
host = "api.${var.dns_zone_prefix_prf}.${var.external_domain}"
port = 443
ip_addresses = module.apim[0].private_ip_addresses
fqdns = ["api.${var.dns_zone_prefix_prf}.${var.external_domain}."]
probe = "/status-0123456789abcdef"
probe_name = "probe-apimprf"
request_timeout = 120
pick_host_name_from_backend = false
}
}

routes = {
api = {
listener = "api"
backend = "apim"
rewrite_rule_set_name = null
priority = 10
}
}

routes_prf = {
apiprf = {
listener = "apiprf"
backend = "apimprf"
rewrite_rule_set_name = null
priority = 20
}
}

listeners = {
api = {
protocol = "Https"
Expand Down Expand Up @@ -136,19 +183,10 @@ module "app_gw_integration" {
zones = var.integration_appgateway_zones

# Configure backends
backends = {
apim = {
protocol = "Https"
host = "api.${var.dns_zone_prefix}.${var.external_domain}"
port = 443
ip_addresses = module.apim[0].private_ip_addresses
fqdns = ["api.${var.dns_zone_prefix}.${var.external_domain}."]
probe = "/status-0123456789abcdef"
probe_name = "probe-apim"
request_timeout = 120
pick_host_name_from_backend = false
}
}
backends = merge(
local.backends,
var.dns_zone_prefix_prf != "" ? local.backends_prf : {}
)

ssl_profiles = [
{
Expand Down Expand Up @@ -180,14 +218,10 @@ module "app_gw_integration" {
)

# maps listener to backend
routes = {
api = {
listener = "api"
backend = "apim"
rewrite_rule_set_name = null
priority = 10
}
}
routes = merge(
local.routes,
var.dns_zone_prefix_prf != "" ? local.routes_prf : {}
)

rewrite_rule_sets = []

Expand Down
11 changes: 11 additions & 0 deletions src/next-core/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,17 @@ variable "dns_a_reconds_dbnodonexipostgres_prf_ips" {
default = []
}

variable "dns_a_reconds_dbnodonexipostgres_prf_balancer_1_ips" {
type = list(string)
description = "IPs address of DB Nodo PostgreSQL Nexi"
default = []
}

variable "dns_a_reconds_dbnodonexipostgres_prf_balancer_2_ips" {
type = list(string)
description = "IPs address of DB Nodo PostgreSQL Nexi"
default = []
}

#
# dns forwarder
Expand Down
12 changes: 7 additions & 5 deletions src/next-core/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ dns_zone_internal_prefix = "internal.uat.platform"
dns_zone_prefix_prf = "prf.platform"
dns_zone_wfesp = "wfesp.test"

private_dns_zone_db_nodo_pagamenti = "u.db-nodo-pagamenti.com"
dns_a_reconds_dbnodo_ips = ["10.70.73.10"] # db onCloud
dns_a_reconds_dbnodo_prf_ips = ["10.70.73.20"] # db onCloud prf
dns_a_reconds_dbnodonexipostgres_ips = ["10.222.214.174"] # db onPrem PostgreSQL
dns_a_reconds_dbnodonexipostgres_prf_ips = ["10.222.214.184"] # db onPrem PostgreSQL
private_dns_zone_db_nodo_pagamenti = "u.db-nodo-pagamenti.com"
dns_a_reconds_dbnodo_ips = ["10.70.73.10"] # db onCloud
dns_a_reconds_dbnodo_prf_ips = ["10.70.73.20"] # db onCloud prf
dns_a_reconds_dbnodonexipostgres_ips = ["10.222.214.174"] # db onPrem PostgreSQL
dns_a_reconds_dbnodonexipostgres_prf_ips = ["10.222.214.184"] # db onPrem PostgreSQL
dns_a_reconds_dbnodonexipostgres_prf_balancer_1_ips = ["10.222.214.127"] # db onPrem PRF PostgreSQL
dns_a_reconds_dbnodonexipostgres_prf_balancer_2_ips = ["10.222.214.128"] # db onPrem PRF PostgreSQL
### External resources

monitor_resource_group_name = "pagopa-u-monitor-rg"
Expand Down
Loading