Skip to content

Commit

Permalink
[EC-376] Remove app backend 3 (#1099)
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 authored Jul 30, 2024
1 parent 95aa1a8 commit 30f66a8
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 201 deletions.
7 changes: 0 additions & 7 deletions src/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@
| <a name="module_app_backend_web_test_api"></a> [app\_backend\_web\_test\_api](#module\_app\_backend\_web\_test\_api) | github.com/pagopa/terraform-azurerm-v3//application_insights_web_test_preview | v8.29.1 |
| <a name="module_app_backendl1_snet"></a> [app\_backendl1\_snet](#module\_app\_backendl1\_snet) | github.com/pagopa/terraform-azurerm-v3//subnet | v8.27.0 |
| <a name="module_app_backendl2_snet"></a> [app\_backendl2\_snet](#module\_app\_backendl2\_snet) | github.com/pagopa/terraform-azurerm-v3//subnet | v8.27.0 |
| <a name="module_app_backendl3_snet"></a> [app\_backendl3\_snet](#module\_app\_backendl3\_snet) | github.com/pagopa/terraform-azurerm-v3//subnet | v8.27.0 |
| <a name="module_app_backendli_snet"></a> [app\_backendli\_snet](#module\_app\_backendli\_snet) | github.com/pagopa/terraform-azurerm-v3//subnet | v8.27.0 |
| <a name="module_app_gw"></a> [app\_gw](#module\_app\_gw) | github.com/pagopa/terraform-azurerm-v3//app_gateway | v8.31.0 |
| <a name="module_appgateway_snet"></a> [appgateway\_snet](#module\_appgateway\_snet) | github.com/pagopa/terraform-azurerm-v3//subnet | v8.27.0 |
| <a name="module_appservice_app_backendl1"></a> [appservice\_app\_backendl1](#module\_appservice\_app\_backendl1) | github.com/pagopa/terraform-azurerm-v3//app_service | v8.31.0 |
| <a name="module_appservice_app_backendl1_slot_staging"></a> [appservice\_app\_backendl1\_slot\_staging](#module\_appservice\_app\_backendl1\_slot\_staging) | github.com/pagopa/terraform-azurerm-v3//app_service_slot | v8.31.0 |
| <a name="module_appservice_app_backendl2"></a> [appservice\_app\_backendl2](#module\_appservice\_app\_backendl2) | github.com/pagopa/terraform-azurerm-v3//app_service | v8.31.0 |
| <a name="module_appservice_app_backendl2_slot_staging"></a> [appservice\_app\_backendl2\_slot\_staging](#module\_appservice\_app\_backendl2\_slot\_staging) | github.com/pagopa/terraform-azurerm-v3//app_service_slot | v8.31.0 |
| <a name="module_appservice_app_backendl3"></a> [appservice\_app\_backendl3](#module\_appservice\_app\_backendl3) | github.com/pagopa/terraform-azurerm-v3//app_service | v8.31.0 |
| <a name="module_appservice_app_backendl3_slot_staging"></a> [appservice\_app\_backendl3\_slot\_staging](#module\_appservice\_app\_backendl3\_slot\_staging) | github.com/pagopa/terraform-azurerm-v3//app_service_slot | v8.31.0 |
| <a name="module_appservice_app_backendli"></a> [appservice\_app\_backendli](#module\_appservice\_app\_backendli) | github.com/pagopa/terraform-azurerm-v3//app_service | v8.31.0 |
| <a name="module_appservice_app_backendli_slot_staging"></a> [appservice\_app\_backendli\_slot\_staging](#module\_appservice\_app\_backendli\_slot\_staging) | github.com/pagopa/terraform-azurerm-v3//app_service_slot | v8.31.0 |
| <a name="module_assets_cdn"></a> [assets\_cdn](#module\_assets\_cdn) | github.com/pagopa/terraform-azurerm-v3//storage_account | v8.27.0 |
Expand Down Expand Up @@ -148,14 +145,11 @@
| [azurerm_monitor_metric_alert.too_many_http_5xx](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_metric_alert) | resource |
| [azurerm_monitor_scheduled_query_rules_alert.mailup_alert_rule](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource |
| [azurerm_network_security_group.nsg_apim](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_security_group) | resource |
| [azurerm_private_endpoint.backend3_sites](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource |
| [azurerm_private_endpoint.backend3_staging_sites](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource |
| [azurerm_private_endpoint.locked_profiles_storage_table](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource |
| [azurerm_public_ip.appgateway_public_ip](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource |
| [azurerm_public_ip.public_ip_apim](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource |
| [azurerm_resource_group.assets_cdn_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.azdo_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.backend3](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.container_registry_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.data](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
| [azurerm_resource_group.default_roleassignment_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
Expand All @@ -175,7 +169,6 @@
| [azurerm_storage_table.storage_api_validationtokens](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_table) | resource |
| [azurerm_subnet_nat_gateway_association.app_backendl1_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_nat_gateway_association) | resource |
| [azurerm_subnet_nat_gateway_association.app_backendl2_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_nat_gateway_association) | resource |
| [azurerm_subnet_nat_gateway_association.app_backendl3_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_nat_gateway_association) | resource |
| [azurerm_subnet_nat_gateway_association.app_backendli_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_nat_gateway_association) | resource |
| [azurerm_subnet_network_security_group_association.snet_nsg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet_network_security_group_association) | resource |
| [azurerm_user_assigned_identity.appgateway](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity) | resource |
Expand Down
151 changes: 0 additions & 151 deletions src/core/app_backend.tf
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,6 @@ locals {
API_URL = "https://${data.azurerm_linux_function_app.function_app[1].default_hostname}/api/v1"
APP_MESSAGES_API_URL = "https://${data.azurerm_linux_function_app.app_messages_2.default_hostname}/api/v1"
}
app_settings_l3 = {
IS_APPBACKENDLI = "false"
// FUNCTIONS
API_URL = "https://${data.azurerm_linux_function_app.function_app[1].default_hostname}/api/v1"
APP_MESSAGES_API_URL = "https://${data.azurerm_linux_function_app.app_messages_2.default_hostname}/api/v1"
}
app_settings_li = {
IS_APPBACKENDLI = "true"
// FUNCTIONS
Expand All @@ -388,13 +382,6 @@ locals {
path = "/info",
http_status = 200,
},
{
id = "io-p-app-appbackendl3.azurewebsites.net"
name = module.appservice_app_backendl3.default_site_hostname,
host = module.appservice_app_backendl3.default_site_hostname,
path = "/info",
http_status = 200,
},
{
id = "io-p-app-appbackendli.azurewebsites.net"
name = module.appservice_app_backendli.default_site_hostname,
Expand Down Expand Up @@ -473,13 +460,6 @@ resource "azurerm_resource_group" "rg_linux" {
tags = var.tags
}

resource "azurerm_resource_group" "backend3" {
name = format("%s-weu-backend-rg-03", local.project)
location = var.location

tags = var.tags
}

## key vault

data "azurerm_key_vault_secret" "app_backend_SAML_CERT" {
Expand Down Expand Up @@ -728,137 +708,6 @@ resource "azurerm_key_vault_secret" "appbackend_THIRD_PARTY_CONFIG_LIST" {
content_type = "string"
}

## app_backendl3
module "app_backendl3_snet" {
source = "github.com/pagopa/terraform-azurerm-v3//subnet?ref=v8.27.0"
name = "${local.project}-weu-backend-snet-03"
address_prefixes = ["10.0.156.0/24"]
resource_group_name = azurerm_resource_group.rg_common.name
virtual_network_name = data.azurerm_virtual_network.common.name
private_endpoint_network_policies_enabled = true

service_endpoints = [
"Microsoft.Web",
]

delegation = {
name = "default"
service_delegation = {
name = "Microsoft.Web/serverFarms"
actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
}
}
}

resource "azurerm_subnet_nat_gateway_association" "app_backendl3_snet" {
nat_gateway_id = data.azurerm_nat_gateway.ng.id
subnet_id = module.app_backendl3_snet.id
}

module "appservice_app_backendl3" {
source = "github.com/pagopa/terraform-azurerm-v3//app_service?ref=v8.31.0"

# App service plan
plan_type = "internal"
plan_name = format("%s-weu-backend-asp-03", local.project)
sku_name = var.app_backend_plan_sku_size

# App service
name = format("%s-weu-backend-app-03", local.project)
resource_group_name = azurerm_resource_group.backend3.name
location = azurerm_resource_group.backend3.location

node_version = "18-lts"
always_on = true
app_command_line = local.app_backend.app_command_line
health_check_path = "/ping"
health_check_maxpingfailures = 2

app_settings = merge(
local.app_backend.app_settings_common,
local.app_backend.app_settings_l3,
)

ip_restriction_default_action = "Deny"

subnet_id = module.app_backendl3_snet.id
vnet_integration = true

tags = var.tags
}

resource "azurerm_private_endpoint" "backend3_sites" {
name = "${local.project}-weu-backend-app-pep-03"
location = azurerm_resource_group.backend3.location
resource_group_name = azurerm_resource_group.backend3.name
subnet_id = data.azurerm_subnet.private_endpoints_subnet.id

private_service_connection {
name = "${local.project}-weu-backend-app-pep-03"
private_connection_resource_id = module.appservice_app_backendl3.id
is_manual_connection = false
subresource_names = ["sites"]
}

private_dns_zone_group {
name = "private-dns-zone-group"
private_dns_zone_ids = [data.azurerm_private_dns_zone.privatelink_azurewebsites.id]
}

tags = var.tags
}

module "appservice_app_backendl3_slot_staging" {
source = "github.com/pagopa/terraform-azurerm-v3//app_service_slot?ref=v8.31.0"

# App service plan
app_service_id = module.appservice_app_backendl3.id
app_service_name = module.appservice_app_backendl3.name

# App service
name = "staging"
resource_group_name = azurerm_resource_group.backend3.name
location = azurerm_resource_group.backend3.location

always_on = true
node_version = "18-lts"
app_command_line = local.app_backend.app_command_line
health_check_path = "/ping"

app_settings = merge(
local.app_backend.app_settings_common,
local.app_backend.app_settings_l3,
)

ip_restriction_default_action = "Deny"

subnet_id = module.app_backendl3_snet.id
vnet_integration = true

tags = var.tags
}

resource "azurerm_private_endpoint" "backend3_staging_sites" {
name = "${local.project}-weu-backend-staging-app-pep-03"
location = azurerm_resource_group.backend3.location
resource_group_name = azurerm_resource_group.backend3.name
subnet_id = data.azurerm_subnet.private_endpoints_subnet.id

private_service_connection {
name = "${local.project}-weu-backend-staging-app-pep-03"
private_connection_resource_id = module.appservice_app_backendl3.id
is_manual_connection = false
subresource_names = ["sites-${module.appservice_app_backendl3_slot_staging.name}"]
}

private_dns_zone_group {
name = "private-dns-zone-group"
private_dns_zone_ids = [data.azurerm_private_dns_zone.privatelink_azurewebsites.id]
}

tags = var.tags
}

## app_backendl1

module "app_backendl1_snet" {
Expand Down
6 changes: 0 additions & 6 deletions src/domains/cgn/_modules/functions_apps/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ data "azurerm_subnet" "snet_backendl2" {
resource_group_name = local.resource_group_name_common
}

data "azurerm_subnet" "snet_backendl3" {
name = "io-p-weu-backend-snet-03"
virtual_network_name = local.vnet_name_common
resource_group_name = local.resource_group_name_common
}

data "azurerm_subnet" "snet_backendli" {
name = "appbackendli"
virtual_network_name = local.vnet_name_common
Expand Down
2 changes: 0 additions & 2 deletions src/domains/cgn/_modules/functions_apps/function_app_cgn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ module "function_cgn" {
var.subnet_id,
data.azurerm_subnet.snet_backendl1.id,
data.azurerm_subnet.snet_backendl2.id,
data.azurerm_subnet.snet_backendl3.id,
data.azurerm_subnet.snet_backendli.id,
data.azurerm_subnet.snet_apim_v2.id,
]
Expand Down Expand Up @@ -90,7 +89,6 @@ module "function_cgn_staging_slot" {
data.azurerm_subnet.snet_azdoa.id,
data.azurerm_subnet.snet_backendl1.id,
data.azurerm_subnet.snet_backendl2.id,
data.azurerm_subnet.snet_backendl3.id,
data.azurerm_subnet.snet_backendli.id,
data.azurerm_subnet.snet_apim_v2.id,
]
Expand Down
6 changes: 0 additions & 6 deletions src/domains/citizen-auth-app/01_network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ data "azurerm_subnet" "app_backend_l2_snet" {
resource_group_name = local.vnet_common_resource_group_name
}

data "azurerm_subnet" "app_backend_l3_snet" {
name = "io-p-weu-backend-snet-03"
virtual_network_name = local.vnet_common_name
resource_group_name = local.vnet_common_resource_group_name
}

data "azurerm_subnet" "ioweb_profile_snet" {
name = format("%s-ioweb-profile-snet", local.common_project)
virtual_network_name = local.vnet_common_name
Expand Down
4 changes: 1 addition & 3 deletions src/domains/citizen-auth-app/07_function_fast_login.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ module "function_fast_login" {
data.azurerm_subnet.apim_v2_snet.id,
data.azurerm_subnet.app_backend_l1_snet.id,
data.azurerm_subnet.app_backend_l2_snet.id,
data.azurerm_subnet.app_backend_l3_snet.id,
data.azurerm_subnet.ioweb_profile_snet.id,
module.session_manager_snet.id,
]
Expand Down Expand Up @@ -189,8 +188,7 @@ module "function_fast_login_staging_slot" {
data.azurerm_subnet.azdoa_snet[0].id,
data.azurerm_subnet.apim_v2_snet.id,
data.azurerm_subnet.app_backend_l1_snet.id,
data.azurerm_subnet.app_backend_l2_snet.id,
data.azurerm_subnet.app_backend_l3_snet.id,
data.azurerm_subnet.app_backend_l2_snet.id
]

tags = var.tags
Expand Down
1 change: 0 additions & 1 deletion src/domains/citizen-auth-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
| [azurerm_subnet.apim_v2_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.app_backend_l1_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.app_backend_l2_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.app_backend_l3_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.appgateway_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.azdoa_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.fims_op_app_snet_01](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
Expand Down
6 changes: 0 additions & 6 deletions src/domains/eucovidcert/_modules/function_apps/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ data "azurerm_subnet" "snet_backendl2" {
resource_group_name = local.resource_group_name_common
}

data "azurerm_subnet" "snet_backendl3" {
name = "io-p-weu-backend-snet-03"
virtual_network_name = local.vnet_name_common
resource_group_name = local.resource_group_name_common
}

data "azurerm_subnet" "snet_pblevtdispatcher" {
name = "fnpblevtdispatcherout"
virtual_network_name = local.vnet_name_common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ module "function_eucovidcert" {
var.subnet_id,
data.azurerm_subnet.snet_backendl1.id,
data.azurerm_subnet.snet_backendl2.id,
data.azurerm_subnet.snet_backendl3.id,
data.azurerm_subnet.snet_pblevtdispatcher.id,
data.azurerm_subnet.snet_apim_v2.id,
]
Expand Down Expand Up @@ -78,7 +77,6 @@ module "function_eucovidcert_staging_slot" {
var.subnet_id,
data.azurerm_subnet.snet_backendl1.id,
data.azurerm_subnet.snet_backendl2.id,
data.azurerm_subnet.snet_backendl3.id,
data.azurerm_subnet.snet_pblevtdispatcher.id,
data.azurerm_subnet.snet_apim_v2.id,
]
Expand Down
6 changes: 0 additions & 6 deletions src/domains/functions/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,3 @@ data "azurerm_subnet" "app_backendl2_snet" {
resource_group_name = local.rg_common_name
virtual_network_name = local.vnet_common_name
}

data "azurerm_subnet" "app_backendl3_snet" {
name = "io-p-weu-backend-snet-03"
resource_group_name = local.rg_common_name
virtual_network_name = local.vnet_common_name
}
2 changes: 0 additions & 2 deletions src/domains/functions/function_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ module "function_app" {
module.app_snet[count.index].id,
data.azurerm_subnet.app_backendl1_snet.id,
data.azurerm_subnet.app_backendl2_snet.id,
data.azurerm_subnet.app_backendl3_snet.id,
data.azurerm_subnet.app_backendli_snet.id,
data.azurerm_subnet.ioweb_profile_snet.id,
data.azurerm_subnet.session_manager_snet.id,
Expand Down Expand Up @@ -289,7 +288,6 @@ module "function_app_staging_slot" {
data.azurerm_subnet.azdoa_snet.id,
data.azurerm_subnet.app_backendl1_snet.id,
data.azurerm_subnet.app_backendl2_snet.id,
data.azurerm_subnet.app_backendl3_snet.id,
data.azurerm_subnet.app_backendli_snet.id,
]

Expand Down
6 changes: 0 additions & 6 deletions src/domains/messages-app/01_network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ data "azurerm_subnet" "app_backendl2_snet" {
resource_group_name = local.vnet_common_resource_group_name
}

data "azurerm_subnet" "app_backendl3_snet" {
name = "io-p-weu-backend-snet-03"
virtual_network_name = local.vnet_common_name
resource_group_name = local.vnet_common_resource_group_name
}

data "azurerm_subnet" "apim_snet" {
name = "apimv2api"
virtual_network_name = local.vnet_common_name
Expand Down
2 changes: 0 additions & 2 deletions src/domains/messages-app/10_function_messages.tf
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ module "app_messages_function" {
module.app_messages_snet[count.index].id,
data.azurerm_subnet.app_backendl1_snet.id,
data.azurerm_subnet.app_backendl2_snet.id,
data.azurerm_subnet.app_backendl3_snet.id,
data.azurerm_subnet.apim_snet.id,
]

Expand Down Expand Up @@ -221,7 +220,6 @@ module "app_messages_function_staging_slot" {
module.app_messages_snet[count.index].id,
data.azurerm_subnet.app_backendl1_snet.id,
data.azurerm_subnet.app_backendl2_snet.id,
data.azurerm_subnet.app_backendl3_snet.id,
data.azurerm_subnet.azdoa_snet.id,
]

Expand Down
1 change: 0 additions & 1 deletion src/domains/messages-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
| [azurerm_subnet.apim_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.app_backendl1_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.app_backendl2_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.app_backendl3_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.azdoa_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.private_endpoints_subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.runner_subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
Expand Down

0 comments on commit 30f66a8

Please sign in to comment.