Skip to content

Commit

Permalink
UPDATE DEV vars for send pec email (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-putzu authored Jul 5, 2024
1 parent 8950eaa commit a2a92ab
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
4 changes: 4 additions & 0 deletions infra/functions/onboarding-functions/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ app_settings = {
"BLOB_STORAGE_CONN_STRING_CONTRACT" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/contracts-storage-blob-connection-string/)",
"MAIL_DESTINATION_TEST_ADDRESS" = "pectest@pec.pagopa.it",
"MAIL_TEMPLATE_REGISTRATION_REQUEST_PT_PATH" = "contracts/template/mail/registration-request-pt/1.0.0.json",
"MAIL_SENDER_ADDRESS" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/smtp-not-pec-usr/)",
"MAIL_SERVER_USERNAME" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/smtp-not-pec-usr/)",
"MAIL_SERVER_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/smtp-not-pec-psw/)",
"MAIL_SENDER_ADDRESS" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/smtp-usr/)",
"MAIL_SERVER_USERNAME" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/smtp-usr/)",
"MAIL_SERVER_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-d-pnpg-kv.vault.azure.net/secrets/smtp-psw/)",
"MAIL_SERVER_HOST" = "smtps.pec.aruba.it",
"MAIL_SERVER_PORT" = "465",
"MAIL_SERVER_SSL" = "false"
"MAIL_TEMPLATE_REGISTRATION_NOTIFICATION_ADMIN_PATH" = "contracts/template/mail/registration-notification-admin/1.0.0.json",
"MAIL_TEMPLATE_NOTIFICATION_PATH" = "contracts/template/mail/onboarding-notification/1.0.0.json",
Expand Down
21 changes: 5 additions & 16 deletions infra/functions/onboarding-functions/functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,22 @@ data "azurerm_resource_group" "nat_rg" {
}

data "azurerm_resource_group" "vnet_rg" {
name = "${local.base_domain_name}-vnet-rg"
}


data "azurerm_public_ip" "aks_pip_outbound" {
resource_group_name = data.azurerm_resource_group.vnet_rg.name
name = "${local.base_domain_name}-aksoutbound-pip-01" //selc-d-aksoutbound-pip-01
name = "${local.base_domain_vnet_name}-vnet-rg"
}

data "azurerm_public_ip" "pip_outbound" {
resource_group_name = data.azurerm_resource_group.nat_rg.name
name = "${local.base_domain_name}-pip-outbound" //selc-d-pip-outbound
}

data "azurerm_public_ip" "functions_pip_outbound" {
resource_group_name = data.azurerm_resource_group.nat_rg.name
name = "${local.app_name}-pip-outbound" //selc-d-onboarding-fn-pip-outbound
resource_group_name = var.is_pnpg == true ? data.azurerm_resource_group.nat_rg.name : data.azurerm_resource_group.vnet_rg.name
name = var.is_pnpg == true ? "${local.base_domain_name}-pip-outbound" : "${local.base_domain_name}-aksoutbound-pip-01"
}

data "azurerm_nat_gateway" "nat_gateway" {
name = "${local.base_domain_name}-nat_gw" //selc-d-nat_gw
name = "${local.base_domain_name}-nat_gw"
resource_group_name = data.azurerm_resource_group.nat_rg.name
}

resource "azurerm_nat_gateway_public_ip_association" "functions_pip_nat_gateway" {
nat_gateway_id = data.azurerm_nat_gateway.nat_gateway.id
public_ip_address_id = var.is_pnpg == true ? data.azurerm_public_ip.functions_pip_outbound.id : data.azurerm_public_ip.aks_pip_outbound.id
public_ip_address_id = data.azurerm_public_ip.pip_outbound.id
}

resource "azurerm_subnet_nat_gateway_association" "functions_subnet_nat_gateway" {
Expand Down
8 changes: 5 additions & 3 deletions infra/functions/onboarding-functions/locals.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
locals {
pnpg_suffix = var.is_pnpg == true ? "-pnpg" : ""
pnpg_domain_suffix = var.is_pnpg == true ? "-weu-pnpg" : ""
project = "${var.prefix}-${var.env_short}"
pnpg_suffix = var.is_pnpg == true ? "-pnpg" : ""
pnpg_domain_suffix = var.is_pnpg == true ? "-weu-pnpg" : ""
pnpg_domain_vnet_suffix = var.is_pnpg == true ? "-weu" : ""
project = "${var.prefix}-${var.env_short}"

app_name = "${local.project}${local.pnpg_suffix}-onboarding-fn"
base_domain_name = "${local.project}${local.pnpg_domain_suffix}"
base_domain_vnet_name = "${local.project}${local.pnpg_domain_vnet_suffix}"
vnet_name = "${local.project}-vnet-rg"
monitor_rg_name = "${local.project}-monitor-rg"
monitor_appinsights_name = "${local.project}-appinsights"
Expand Down

0 comments on commit a2a92ab

Please sign in to comment.