Skip to content

Commit

Permalink
feat: Postgres private dns dev (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamari90 authored Apr 3, 2024
1 parent 207b510 commit 4c2e5de
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/domains/fdr-common/env/weu-dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,5 @@ fdr_history_storage_account = {
# replica settings
#
geo_replica_enabled = false
postgres_dns_registration_enabled = false
postgres_dns_registration_enabled = true

2 changes: 1 addition & 1 deletion src/domains/gps-common/env/weu-dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pgres_flex_params = {
pgbouncer_enabled = true
alerts_enabled = false
max_connections = 1000
enable_private_dns_registration = false
enable_private_dns_registration = true
}

cidr_subnet_gps_cosmosdb = ["10.1.149.0/24"]
Expand Down
2 changes: 1 addition & 1 deletion src/domains/nodo-common/env/weu-dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pgres_flex_params = {
pgres_flex_pgbouncer_enabled = true
pgres_flex_diagnostic_settings_enabled = false
max_connections = 1700
enable_private_dns_registration = false
enable_private_dns_registration = true
}

sftp_account_replication_type = "LRS"
Expand Down
4 changes: 2 additions & 2 deletions src/next-core/01_network_dns_private.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# db dns

resource "azurerm_private_dns_zone" "private_db_dns_zone" {
count = var.postgres_private_dns_enabled ? 1 : 0
count = var.is_feature_enabled.postgres_private_dns ? 1 : 0
name = "${var.env_short}.internal.postgresql.pagopa.it"
resource_group_name = data.azurerm_resource_group.rg_vnet_core.name

tags = var.tags
}

resource "azurerm_private_dns_zone_virtual_network_link" "private_db_zone_to_core_vnet" {
count = var.postgres_private_dns_enabled ? 1 : 0
count = var.is_feature_enabled.postgres_private_dns ? 1 : 0

name = data.azurerm_virtual_network.vnet_core.name
resource_group_name = data.azurerm_resource_group.rg_vnet_core.name
Expand Down
8 changes: 2 additions & 6 deletions src/next-core/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,6 @@ variable "geo_replica_ddos_protection_plan" {
default = null
}

variable "postgres_private_dns_enabled" {
type = bool
description = "(Optional) If true creates a private dns that can be used to access the postgres databases"
default = false
}


variable "logos_donations_storage_account_replication_type" {
Expand Down Expand Up @@ -648,7 +643,8 @@ variable "is_feature_enabled" {
type = object({
vnet_ita = bool,
container_app_tools_cae = optional(bool, false),
node_forwarder_ha_enabled = bool
node_forwarder_ha_enabled = bool,
postgres_private_dns = bool
})
description = "Features enabled in this domain"
}
Expand Down
4 changes: 2 additions & 2 deletions src/next-core/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ tags = {
is_feature_enabled = {
vnet_ita = true,
container_app_tools_cae = true,
node_forwarder_ha_enabled = true
node_forwarder_ha_enabled = true,
postgres_private_dns = true
}

### Network
Expand All @@ -48,7 +49,6 @@ dns_forwarder_backup_is_enabled = false
# replica settings
#
geo_replica_enabled = false
postgres_private_dns_enabled = false


#
Expand Down
4 changes: 2 additions & 2 deletions src/next-core/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ tags = {
is_feature_enabled = {
vnet_ita = false,
container_app_tools_cae = false,
node_forwarder_ha_enabled = false
node_forwarder_ha_enabled = false,
postgres_private_dns = true
}

#
Expand Down Expand Up @@ -61,7 +62,6 @@ geo_replica_ddos_protection_plan = {
enable = true
}

postgres_private_dns_enabled = true

enable_logos_backup = true
logos_backup_retention = 30
Expand Down
4 changes: 2 additions & 2 deletions src/next-core/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ tags = {
is_feature_enabled = {
vnet_ita = false,
container_app_tools_cae = true,
node_forwarder_ha_enabled = false
node_forwarder_ha_enabled = false,
postgres_private_dns = true
}

#
Expand Down Expand Up @@ -53,7 +54,6 @@ dns_forwarder_vm_image_name = "pagopa-u-dns-forwarder-ubuntu2204-image-v4"
# replica settings
#
geo_replica_enabled = false
postgres_private_dns_enabled = true

#
# apim v2
Expand Down

0 comments on commit 4c2e5de

Please sign in to comment.