Skip to content

Commit

Permalink
[#IOPID-2040] change fn app references to itn resources (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcogabbo authored Oct 3, 2024
1 parent e5dd019 commit f7bc1a4
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/common/prod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
| [azurerm_api_management.trial_system](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source |
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source |
| [azurerm_linux_function_app.eucovidcert](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.function_app](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.function_assets_cdn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.function_cgn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.function_profile](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.io_sign_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.lollipop_function](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
| [azurerm_linux_function_app.services_app_backend_function_app](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/linux_function_app) | data source |
Expand Down
11 changes: 6 additions & 5 deletions src/common/prod/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ data "azurerm_linux_function_app" "function_assets_cdn" {
resource_group_name = "${local.project_weu_legacy}-assets-cdn-rg"
}

data "azurerm_linux_function_app" "function_app" {
count = local.function_app_count
name = "${local.project_weu_legacy}-app-fn-${count.index + 1}"
resource_group_name = "${local.project_weu_legacy}-app-rg-${count.index + 1}"
data "azurerm_linux_function_app" "function_profile" {
count = local.function_profile_count
name = "${local.project_itn}-auth-profile-fn-0${count.index + 1}"
resource_group_name = "${local.project_itn}-profile-rg-0${count.index + 1}"
}

data "azurerm_linux_function_app" "services_app_backend_function_app" {
Expand Down Expand Up @@ -113,4 +113,5 @@ data "azurerm_subnet" "itn_msgs_sending_func_snet" {
name = "${local.project_itn}-msgs-sending-func-snet-01"
resource_group_name = local.core.networking.itn.vnet_common.resource_group_name
virtual_network_name = local.core.networking.itn.vnet_common.name
}
}

11 changes: 6 additions & 5 deletions src/common/prod/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ locals {

core = data.terraform_remote_state.core.outputs

function_app_count = 2
function_profile_count = 2

# TODO: edit this block when resource groups module is implemented
resource_groups = {
Expand Down Expand Up @@ -50,7 +50,7 @@ locals {
app_settings_override = {
IS_APPBACKENDLI = "false"
// FUNCTIONS
API_URL = "https://${data.azurerm_linux_function_app.function_app[1].default_hostname}/api/v1"
API_URL = "https://${data.azurerm_linux_function_app.function_profile[1].default_hostname}/api/v1"
APP_MESSAGES_API_URL = "https://io-p-app-messages-fn-1.azurewebsites.net/api/v1"
}
},
Expand All @@ -59,7 +59,7 @@ locals {
app_settings_override = {
IS_APPBACKENDLI = "false"
// FUNCTIONS
API_URL = "https://${data.azurerm_linux_function_app.function_app[1].default_hostname}/api/v1"
API_URL = "https://${data.azurerm_linux_function_app.function_profile[1].default_hostname}/api/v1"
APP_MESSAGES_API_URL = "https://io-p-app-messages-fn-2.azurewebsites.net/api/v1"
}
}
Expand All @@ -70,7 +70,7 @@ locals {
app_settings_override = {
IS_APPBACKENDLI = "true"
// FUNCTIONS
API_URL = "https://${data.azurerm_linux_function_app.function_app[1].default_hostname}/api/v1" # not used
API_URL = "https://${data.azurerm_linux_function_app.function_profile[1].default_hostname}/api/v1"
APP_MESSAGES_API_URL = "https://io-p-app-messages-fn-1.azurewebsites.net/api/v1"
}
}
Expand Down Expand Up @@ -275,4 +275,5 @@ locals {
]
}
]
}
}

2 changes: 1 addition & 1 deletion src/domains/citizen-auth-app/08_session_manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ locals {

# Functions App config
API_KEY = data.azurerm_key_vault_secret.functions_app_api_key.value
API_URL = "https://io-p-app-fn-1.azurewebsites.net"
API_URL = "https://io-p-itn-auth-profile-fn-01.azurewebsites.net"

# Functions Fast Login config
FAST_LOGIN_API_KEY = data.azurerm_key_vault_secret.functions_fast_login_api_key.value
Expand Down
11 changes: 11 additions & 0 deletions src/domains/ioweb-app/01_network_itn.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data "azurerm_virtual_network" "common_vnet_italy_north" {
name = format("%s-itn-common-vnet-01", local.product)
resource_group_name = data.azurerm_resource_group.italy_north_common_rg.name
}

data "azurerm_subnet" "function_profile_snet" {
count = 2
name = format("%s-itn-auth-profile-snet-0%d", local.product, count.index + 1)
virtual_network_name = data.azurerm_virtual_network.common_vnet_italy_north.name
resource_group_name = data.azurerm_virtual_network.common_vnet_italy_north.resource_group_name
}
4 changes: 4 additions & 0 deletions src/domains/ioweb-app/05_resource_group.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ resource "azurerm_resource_group" "ioweb_profile_rg" {
data "azurerm_resource_group" "storage_rg" {
name = "${local.common_project}-${var.domain}-storage-rg"
}

data "azurerm_resource_group" "italy_north_common_rg" {
name = format("%s-itn-common-rg-01", local.product)
}
6 changes: 5 additions & 1 deletion src/domains/ioweb-app/06_function_ioweb_profile.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ locals {
// Functions App config
// -------------------------
FUNCTIONS_APP_API_KEY = data.azurerm_key_vault_secret.functions_app_api_key.value
FUNCTIONS_APP_CLIENT_BASE_URL = "https://io-p-app-fn-2.azurewebsites.net"
FUNCTIONS_APP_CLIENT_BASE_URL = "https://io-p-itn-auth-profile-fn-02.azurewebsites.net"

// -------------------------
// Hub Spid Login for ioweb config
Expand Down Expand Up @@ -166,6 +166,8 @@ module "function_ioweb_profile" {
data.azurerm_subnet.apim_v2_snet.id,
data.azurerm_subnet.function_app_snet[0].id,
data.azurerm_subnet.function_app_snet[1].id,
data.azurerm_subnet.function_profile_snet[0].id,
data.azurerm_subnet.function_profile_snet[1].id,
]

enable_healthcheck = false
Expand Down Expand Up @@ -212,6 +214,8 @@ module "function_ioweb_profile_staging_slot" {
data.azurerm_subnet.apim_v2_snet.id,
data.azurerm_subnet.function_app_snet[0].id,
data.azurerm_subnet.function_app_snet[1].id,
data.azurerm_subnet.function_profile_snet[0].id,
data.azurerm_subnet.function_profile_snet[1].id,
]

tags = var.tags
Expand Down
3 changes: 3 additions & 0 deletions src/domains/ioweb-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@
| [azurerm_private_dns_zone.privatelink_file_core_windows_net](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.privatelink_queue_core_windows_net](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_private_dns_zone.privatelink_table_core_windows_net](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/private_dns_zone) | data source |
| [azurerm_resource_group.italy_north_common_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_resource_group.monitor_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_resource_group.storage_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source |
| [azurerm_storage_account.immutable_spid_logs_storage](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account) | data source |
| [azurerm_storage_container.immutable_audit_logs](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_container) | data source |
| [azurerm_subnet.apim_v2_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.function_app_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source |
| [azurerm_subnet.function_profile_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_subscription.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |
| [azurerm_virtual_network.common_vnet_italy_north](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/virtual_network) | data source |
| [azurerm_virtual_network.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/virtual_network) | data source |
| [azurerm_virtual_network.vnet_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/virtual_network) | data source |

Expand Down

0 comments on commit f7bc1a4

Please sign in to comment.