diff --git a/src/core/99_variables.tf b/src/core/99_variables.tf index 8f8c4354f..bdba6313d 100644 --- a/src/core/99_variables.tf +++ b/src/core/99_variables.tf @@ -230,12 +230,12 @@ variable "cidr_subnet_appgateway" { variable "cidr_subnet_apim" { type = list(string) - description = "Api Management address space." + description = "Old Api Management address space." } variable "cidr_subnet_apim_v2" { type = list(string) - description = "Api Management address space." + description = "Api Management V2 address space." } variable "cidr_subnet_vpn" { @@ -455,10 +455,6 @@ variable "apim_publisher_name" { type = string } -variable "apim_sku" { - type = string -} - variable "apim_v2_sku" { type = string } diff --git a/src/core/README.md b/src/core/README.md index 2f7bdf7f3..8499e6f27 100644 --- a/src/core/README.md +++ b/src/core/README.md @@ -17,35 +17,11 @@ | Name | Source | Version | |------|--------|---------| | [admin\_snet](#module\_admin\_snet) | git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet | v4.1.15 | -| [api\_admin](#module\_api\_admin) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [api\_cgn\_merchant](#module\_api\_cgn\_merchant) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [api\_cgn\_os](#module\_api\_cgn\_os) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [api\_public](#module\_api\_public) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [api\_services](#module\_api\_services) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | | [api\_v2\_admin](#module\_api\_v2\_admin) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | | [api\_v2\_cgn\_merchant](#module\_api\_v2\_cgn\_merchant) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | | [api\_v2\_cgn\_os](#module\_api\_v2\_cgn\_os) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | | [api\_v2\_public](#module\_api\_v2\_public) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | | [api\_v2\_services](#module\_api\_v2\_services) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim](#module\_apim) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management | v5.0.1 | -| [apim\_io\_backend\_app\_api\_v1](#module\_apim\_io\_backend\_app\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_auth\_api\_v1](#module\_apim\_io\_backend\_auth\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_bonus\_api\_v1](#module\_apim\_io\_backend\_bonus\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_bpd\_api\_v1](#module\_apim\_io\_backend\_bpd\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_cgn\_api\_v1](#module\_apim\_io\_backend\_cgn\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_eucovidcert\_api\_v1](#module\_apim\_io\_backend\_eucovidcert\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_mitvoucher\_api\_v1](#module\_apim\_io\_backend\_mitvoucher\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_myportal\_api\_v1](#module\_apim\_io\_backend\_myportal\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_notifications\_api\_v1](#module\_apim\_io\_backend\_notifications\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_pagopa\_api\_v1](#module\_apim\_io\_backend\_pagopa\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_product](#module\_apim\_io\_backend\_product) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.15 | -| [apim\_io\_backend\_public\_api\_v1](#module\_apim\_io\_backend\_public\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_io\_backend\_session\_api\_v1](#module\_apim\_io\_backend\_session\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | -| [apim\_product\_admin](#module\_apim\_product\_admin) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.15 | -| [apim\_product\_cgn\_os](#module\_apim\_product\_cgn\_os) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.15 | -| [apim\_product\_merchant](#module\_apim\_product\_merchant) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.15 | -| [apim\_product\_public](#module\_apim\_product\_public) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.15 | -| [apim\_product\_services](#module\_apim\_product\_services) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.15 | | [apim\_snet](#module\_apim\_snet) | git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet | v4.1.15 | | [apim\_v2](#module\_apim\_v2) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management | v6.16.0 | | [apim\_v2\_io\_backend\_app\_api\_v1](#module\_apim\_v2\_io\_backend\_app\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.15 | @@ -181,67 +157,36 @@ |------|------| | [azapi_resource.github_runner_job](https://registry.terraform.io/providers/azure/azapi/latest/docs/resources/resource) | resource | | [azapi_resource.github_runner_job_io_sign](https://registry.terraform.io/providers/azure/azapi/latest/docs/resources/resource) | resource | -| [azurerm_api_management_api_operation_policy.submit_message_for_user_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_operation_policy) | resource | | [azurerm_api_management_api_operation_policy.submit_message_for_user_policy_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_operation_policy) | resource | -| [azurerm_api_management_api_operation_policy.submit_message_for_user_with_fiscalcode_in_body_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_operation_policy) | resource | | [azurerm_api_management_api_operation_policy.submit_message_for_user_with_fiscalcode_in_body_policy_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_operation_policy) | resource | -| [azurerm_api_management_api_version_set.io_backend_app_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_app_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_auth_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_auth_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_bonus_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_bonus_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_bpd_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_bpd_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_cgn_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_cgn_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_eucovidcert_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_eucovidcert_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_mitvoucher_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_mitvoucher_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_myportal_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_myportal_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_notifications_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_notifications_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_pagopa_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_pagopa_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_public_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_public_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_api_version_set.io_backend_session_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | | [azurerm_api_management_api_version_set.io_backend_session_api_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource | -| [azurerm_api_management_group_user.pn_user_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | | [azurerm_api_management_group_user.pn_user_group_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | -| [azurerm_api_management_named_value.api_gad_client_certificate_verified_header](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.api_gad_client_certificate_verified_header_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.cgnonboardingportal_os_header_name](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.cgnonboardingportal_os_header_name_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.cgnonboardingportal_os_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.cgnonboardingportal_os_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.cgnonboardingportal_os_url_value](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.cgnonboardingportal_os_url_value_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_admin_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_admin_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_admin_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_admin_url_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_eucovidcert_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_eucovidcert_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_eucovidcert_url_alt](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_eucovidcert_url_alt_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_public_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_public_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_public_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_public_url_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_services_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_services_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn3_services_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn3_services_url_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn_cgnmerchant_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn_cgnmerchant_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn_cgnmerchant_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn_cgnmerchant_url_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_subscription.pn_lc_subscription](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | | [azurerm_api_management_subscription.pn_lc_subscription_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | -| [azurerm_api_management_user.pn_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_user) | resource | | [azurerm_api_management_user.pn_user_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_user) | resource | | [azurerm_app_service_plan.cgn_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_plan) | resource | | [azurerm_app_service_plan.shared_1_plan](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_plan) | resource | @@ -285,7 +230,6 @@ | [azurerm_key_vault_access_policy.adgroup_admin_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.adgroup_developers](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.adgroup_developers_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | -| [azurerm_key_vault_access_policy.apim_kv_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.apim_v2_kv_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.app_gateway_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.app_gateway_policy_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | @@ -296,7 +240,6 @@ | [azurerm_key_vault_access_policy.azdevops_platform_iac_policy_kv_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.cdn_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.cdn_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | -| [azurerm_key_vault_access_policy.common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.github_action_iac_cd_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.github_action_iac_cd_kv_common](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | | [azurerm_key_vault_access_policy.github_action_iac_ci_kv](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | @@ -482,9 +425,7 @@ | [azuread_service_principal.github_action_iac_cd](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | | [azuread_service_principal.github_action_iac_ci](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | | [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | -| [azurerm_api_management_group.api_lollipop_assertion_read](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_group) | data source | | [azurerm_api_management_group.api_v2_lollipop_assertion_read](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_group) | data source | -| [azurerm_api_management_product.apim_product_lollipop](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_product) | data source | | [azurerm_api_management_product.apim_v2_product_lollipop](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_product) | data source | | [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source | | [azurerm_cosmosdb_account.cosmos_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/cosmosdb_account) | data source | @@ -515,7 +456,6 @@ | [azurerm_key_vault_secret.alert_error_notification_opsgenie](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.alert_error_notification_slack](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.alert_quarantine_error_notification_slack](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.api_gad_client_certificate_verified_header_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.api_gad_client_certificate_verified_header_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.apim_IO_GDPR_SERVICE_KEY](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.apim_publisher_email](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | @@ -613,15 +553,10 @@ | [azurerm_key_vault_secret.fn_services_webhook_channel_aks_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.fn_services_webhook_channel_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.github_runner_pat](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.io_fn3_admin_key_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.io_fn3_admin_key_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.io_fn3_eucovidcert_key_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.io_fn3_eucovidcert_key_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.io_fn3_public_key_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.io_fn3_public_key_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.io_fn3_services_key_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.io_fn3_services_key_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_key_vault_secret.io_fn_cgnmerchant_key_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.io_fn_cgnmerchant_key_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.ioweb_profile_function_api_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.monitor_notification_email](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | @@ -664,7 +599,6 @@ | [apim\_alerts\_enabled](#input\_apim\_alerts\_enabled) | Enable alerts | `bool` | `true` | no | | [apim\_autoscale](#input\_apim\_autoscale) | Configure Apim autoscale on capacity metric |
object(
{
enabled = bool
default_instances = number
minimum_instances = number
maximum_instances = number
scale_out_capacity_percentage = number
scale_out_time_window = string
scale_out_value = string
scale_out_cooldown = string
scale_in_capacity_percentage = number
scale_in_time_window = string
scale_in_value = string
scale_in_cooldown = string
}
)
| n/a | yes | | [apim\_publisher\_name](#input\_apim\_publisher\_name) | # Apim | `string` | n/a | yes | -| [apim\_sku](#input\_apim\_sku) | n/a | `string` | n/a | yes | | [apim\_v2\_sku](#input\_apim\_v2\_sku) | n/a | `string` | n/a | yes | | [app\_backend\_autoscale\_default](#input\_app\_backend\_autoscale\_default) | The number of instances that are available for scaling if metrics are not available for evaluation. | `number` | `10` | no | | [app\_backend\_autoscale\_maximum](#input\_app\_backend\_autoscale\_maximum) | The maximum number of instances for this resource. | `number` | `30` | no | @@ -700,8 +634,8 @@ | [cgn\_legalbackup\_account\_replication\_type](#input\_cgn\_legalbackup\_account\_replication\_type) | Legal backup replication type | `string` | `"GRS"` | no | | [cgn\_legalbackup\_enable\_versioning](#input\_cgn\_legalbackup\_enable\_versioning) | Enable legal backup versioning | `bool` | `false` | no | | [cidr\_common\_vnet](#input\_cidr\_common\_vnet) | Common Virtual network cidr. | `list(string)` | n/a | yes | -| [cidr\_subnet\_apim](#input\_cidr\_subnet\_apim) | Api Management address space. | `list(string)` | n/a | yes | -| [cidr\_subnet\_apim\_v2](#input\_cidr\_subnet\_apim\_v2) | Api Management address space. | `list(string)` | n/a | yes | +| [cidr\_subnet\_apim](#input\_cidr\_subnet\_apim) | Old Api Management address space. | `list(string)` | n/a | yes | +| [cidr\_subnet\_apim\_v2](#input\_cidr\_subnet\_apim\_v2) | Api Management V2 address space. | `list(string)` | n/a | yes | | [cidr\_subnet\_app](#input\_cidr\_subnet\_app) | Function app address space. | `list(string)` | n/a | yes | | [cidr\_subnet\_app\_async](#input\_cidr\_subnet\_app\_async) | Function app async address space. | `list(string)` | n/a | yes | | [cidr\_subnet\_appbackendl1](#input\_cidr\_subnet\_appbackendl1) | App backend l1 address space. | `list(string)` | n/a | yes | diff --git a/src/core/apim.tf b/src/core/apim.tf deleted file mode 100644 index c862d9ffa..000000000 --- a/src/core/apim.tf +++ /dev/null @@ -1,283 +0,0 @@ -# APIM subnet -module "apim_snet" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet?ref=v4.1.15" - name = "apimapi" - resource_group_name = azurerm_resource_group.rg_common.name - virtual_network_name = module.vnet_common.name - address_prefixes = var.cidr_subnet_apim - - private_endpoint_network_policies_enabled = true - - service_endpoints = [ - "Microsoft.Web", - ] -} - - -# ########################### -# ## Api Management (apim) ## -# ########################### - -module "apim" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management?ref=v5.0.1" - - subnet_id = module.apim_snet.id - location = azurerm_resource_group.rg_internal.location - name = format("%s-apim-api", local.project) - resource_group_name = azurerm_resource_group.rg_internal.name - publisher_name = var.apim_publisher_name - publisher_email = data.azurerm_key_vault_secret.apim_publisher_email.value - notification_sender_email = data.azurerm_key_vault_secret.apim_publisher_email.value - sku_name = var.apim_sku - virtual_network_type = "Internal" - - # not used at the moment - redis_connection_string = null # module.redis_apim.primary_connection_string - redis_cache_id = null # module.redis_apim.id - - # This enables the Username and Password Identity Provider - sign_up_enabled = false - - hostname_configuration = { - proxy = [ - { - # io-p-apim-api.azure-api.net - default_ssl_binding = false - host_name = "io-p-apim-api.azure-api.net" - key_vault_id = null - }, - { - # api-internal.io.italia.it - default_ssl_binding = true - host_name = local.apim_hostname_api_internal - key_vault_id = replace( - data.azurerm_key_vault_certificate.api_internal_io_italia_it.secret_id, - "/${data.azurerm_key_vault_certificate.api_internal_io_italia_it.version}", - "" - ) - }, - { - # api-app.internal.io.pagopa.it - default_ssl_binding = false - host_name = local.apim_hostname_api_app_internal - key_vault_id = replace( - data.azurerm_key_vault_certificate.api_app_internal_io_pagopa_it.secret_id, - "/${data.azurerm_key_vault_certificate.api_app_internal_io_pagopa_it.version}", - "" - ) - }, - ] - developer_portal = null - management = null - portal = null - } - - application_insights = { - enabled = true - instrumentation_key = azurerm_application_insights.application_insights.instrumentation_key - } - - lock_enable = false # no lock - - autoscale = var.apim_autoscale - - alerts_enabled = var.apim_alerts_enabled - - action = [ - { - action_group_id = azurerm_monitor_action_group.error_action_group.id - webhook_properties = null - } - ] - - # metrics docs - # https://docs.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-supported#microsoftapimanagementservice - metric_alerts = { - capacity = { - description = "Apim used capacity is too high" - frequency = "PT5M" - window_size = "PT5M" - severity = 1 - auto_mitigate = true - - criteria = [{ - metric_namespace = "Microsoft.ApiManagement/service" - metric_name = "Capacity" - aggregation = "Average" - operator = "GreaterThan" - threshold = 60 - skip_metric_validation = false - dimension = [] - }] - dynamic_criteria = [] - } - - duration = { - description = "Apim abnormal response time" - frequency = "PT5M" - window_size = "PT5M" - severity = 2 - auto_mitigate = true - - criteria = [] - - dynamic_criteria = [{ - metric_namespace = "Microsoft.ApiManagement/service" - metric_name = "Duration" - aggregation = "Average" - operator = "GreaterThan" - alert_sensitivity = "High" - evaluation_total_count = 2 - evaluation_failure_count = 2 - skip_metric_validation = false - ignore_data_before = "2021-01-01T00:00:00Z" # sample data - dimension = [] - }] - } - - requests_failed = { - description = "Apim abnormal failed requests" - frequency = "PT5M" - window_size = "PT5M" - severity = 2 - auto_mitigate = true - - criteria = [] - - dynamic_criteria = [{ - metric_namespace = "Microsoft.ApiManagement/service" - metric_name = "Requests" - aggregation = "Total" - operator = "GreaterThan" - alert_sensitivity = "High" - evaluation_total_count = 2 - evaluation_failure_count = 2 - skip_metric_validation = false - ignore_data_before = "2021-01-01T00:00:00Z" # sample data - dimension = [{ - name = "BackendResponseCode" - operator = "Include" - values = ["5xx"] - }] - }] - } - } - - tags = var.tags -} - -data "azurerm_key_vault_secret" "apim_publisher_email" { - name = "apim-publisher-email" - key_vault_id = module.key_vault.id -} - -data "azurerm_key_vault_certificate" "api_internal_io_italia_it" { - name = replace(local.apim_hostname_api_internal, ".", "-") - key_vault_id = module.key_vault_common.id -} - -data "azurerm_key_vault_certificate" "api_app_internal_io_pagopa_it" { - name = replace(local.apim_hostname_api_app_internal, ".", "-") - key_vault_id = module.key_vault.id -} - -# ## api management key vault policy ## -resource "azurerm_key_vault_access_policy" "apim_kv_policy" { - key_vault_id = module.key_vault.id - tenant_id = data.azurerm_client_config.current.tenant_id - object_id = module.apim.principal_id - - key_permissions = [] - secret_permissions = ["Get", "List"] - certificate_permissions = ["Get", "List"] - storage_permissions = [] -} - -resource "azurerm_key_vault_access_policy" "common" { - key_vault_id = module.key_vault_common.id - tenant_id = data.azurerm_client_config.current.tenant_id - object_id = module.apim.principal_id - - key_permissions = [] - secret_permissions = ["Get", "List"] - certificate_permissions = ["Get", "List"] - storage_permissions = [] -} -data "azurerm_key_vault_secret" "cgnonboardingportal_os_key" { - name = "funccgn-KEY-CGNOS" - key_vault_id = module.key_vault_common.id -} - -data "azurerm_key_vault_secret" "cgnonboardingportal_os_header_name" { - name = "funccgn-KEY-CGNOSHEADERNAME" - key_vault_id = module.key_vault_common.id -} - -resource "azurerm_api_management_named_value" "cgnonboardingportal_os_url_value" { - name = "cgnonboardingportal-os-url" - api_management_name = module.apim.name - resource_group_name = azurerm_resource_group.rg_internal.name - display_name = "cgnonboardingportal-os-url" - value = format("https://cgnonboardingportal-%s-op.azurewebsites.net", var.env_short) -} - -resource "azurerm_api_management_named_value" "cgnonboardingportal_os_key" { - name = "cgnonboardingportal-os-key" - api_management_name = module.apim.name - resource_group_name = azurerm_resource_group.rg_internal.name - display_name = "cgnonboardingportal-os-key" - value = data.azurerm_key_vault_secret.cgnonboardingportal_os_key.value - secret = true -} - -resource "azurerm_api_management_named_value" "cgnonboardingportal_os_header_name" { - name = "cgnonboardingportal-os-header-name" - api_management_name = module.apim.name - resource_group_name = azurerm_resource_group.rg_internal.name - display_name = "cgnonboardingportal-os-header-name" - value = data.azurerm_key_vault_secret.cgnonboardingportal_os_header_name.value - secret = true -} - -################################################################## -# PN APIM User -################################################################## -data "azurerm_api_management_product" "apim_product_lollipop" { - product_id = "io-lollipop-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name -} - -data "azurerm_api_management_group" "api_lollipop_assertion_read" { - name = "apilollipopassertionread" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name -} - -resource "azurerm_api_management_user" "pn_user" { - user_id = "pnapimuser" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - first_name = "PNAPIMuser" - last_name = "PNAPIMuser" - email = "pn-apim-user@pagopa.it" - state = "active" -} - -resource "azurerm_api_management_group_user" "pn_user_group" { - user_id = azurerm_api_management_user.pn_user.user_id - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - group_name = data.azurerm_api_management_group.api_lollipop_assertion_read.name -} - -resource "azurerm_api_management_subscription" "pn_lc_subscription" { - user_id = azurerm_api_management_user.pn_user.id - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_id = data.azurerm_api_management_product.apim_product_lollipop.id - display_name = "PN LC" - state = "active" - allow_tracing = false -} -################################################################## diff --git a/src/core/apim_cgn_operator_search.tf b/src/core/apim_cgn_operator_search.tf deleted file mode 100644 index b6f6f1c87..000000000 --- a/src/core/apim_cgn_operator_search.tf +++ /dev/null @@ -1,43 +0,0 @@ -## Api Operator Search -module "apim_product_cgn_os" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" - - product_id = "cgnoperatorsearch" - display_name = "IO CGN API OPERATOR SEARCH" - description = "Product for CGN Operator Search Api" - - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/cgn_os/_base_policy.xml") -} - -module "api_cgn_os" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = "io-cgn-os-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_product_cgn_os.product_id] - service_url = local.apim_io_backend_api.service_url - - description = "CGN OPERATOR SEARCH API for IO platform." - display_name = "IO CGN OPERATOR SEARCH API" - path = "api/v1/operator-search/cgn" - protocols = ["https"] - revision = "1" - subscription_required = true - - content_format = "swagger-json" - content_value = templatefile("./api/cgn_os/v1/_swagger.json.tpl", - { - host = "api.io.pagopa.it" - } - ) - - xml_content = file("./api/cgn_os/v1/_base_policy.xml") -} diff --git a/src/core/apim_io_admin_api.tf b/src/core/apim_io_admin_api.tf deleted file mode 100644 index 118e4e64d..000000000 --- a/src/core/apim_io_admin_api.tf +++ /dev/null @@ -1,65 +0,0 @@ -module "apim_product_admin" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" - - product_id = "io-admin-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "IO ADMIN API" - description = "ADMIN API for IO platform." - subscription_required = true - approval_required = false - published = true - - policy_xml = file("./api_product/io_admin/_base_policy.xml") -} - -# Named Value fn3-admin -resource "azurerm_api_management_named_value" "io_fn3_admin_url" { - name = "io-fn3-admin-url" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-admin-url" - value = "https://io-p-admin-fn.azurewebsites.net" -} - -data "azurerm_key_vault_secret" "io_fn3_admin_key_secret" { - name = "fn3admin-KEY-APIM" - key_vault_id = module.key_vault_common.id -} - -resource "azurerm_api_management_named_value" "io_fn3_admin_key" { - name = "io-fn3-admin-key" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-admin-key" - value = data.azurerm_key_vault_secret.io_fn3_admin_key_secret.value - secret = "true" -} - -module "api_admin" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = "io-admin-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - revision = "1" - display_name = "IO ADMIN API" - description = "ADMIN API for IO platform." - - path = "adm" - protocols = ["http", "https"] - product_ids = [module.apim_product_admin.product_id] - - service_url = null - - subscription_required = true - - content_format = "swagger-json" - content_value = templatefile("./api/io_admin/v1/_swagger.json.tpl", - { - host = "api.io.pagopa.it" - } - ) - - xml_content = file("./api/io_admin/v1/policy.xml") -} diff --git a/src/core/apim_io_backend_v1.tf b/src/core/apim_io_backend_v1.tf deleted file mode 100644 index e1ea838a1..000000000 --- a/src/core/apim_io_backend_v1.tf +++ /dev/null @@ -1,457 +0,0 @@ -############## -## Products ## -############## - -module "apim_io_backend_product" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" - - product_id = "io-backend" - display_name = "IO BACKEND" - description = "Product for IO backend" - - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/io_backend/_base_policy.xml") -} - -locals { - apim_io_backend_api = { - # params for all api versions - display_name = "IO BACKEND API" - description = "IO backend APIs" - path = "api/io-backend" - subscription_required = false - service_url = null - } -} - -## BPD -resource "azurerm_api_management_api_version_set" "io_backend_bpd_api" { - name = format("%s-io-backend-bpd-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - bpd" - versioning_scheme = "Segment" -} - -module "apim_io_backend_bpd_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-bpd-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_bpd_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - bpd" - display_name = "${local.apim_io_backend_api.display_name} - bpd" - path = "bpd/api" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/bpd/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/bpd/v1/_base_policy.xml") -} -## - -## MYPORTAL -resource "azurerm_api_management_api_version_set" "io_backend_myportal_api" { - name = format("%s-io-backend-myportal-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - myportal" - versioning_scheme = "Segment" -} - -module "apim_io_backend_myportal_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-myportal-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_myportal_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - myportal" - display_name = "${local.apim_io_backend_api.display_name} - myportal" - path = "myportal/api" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/myportal/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/myportal/v1/_base_policy.xml") -} -## - -## PAGOPA -resource "azurerm_api_management_api_version_set" "io_backend_pagopa_api" { - name = format("%s-io-backend-pagopa-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - pagopa" - versioning_scheme = "Segment" -} - -module "apim_io_backend_pagopa_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-pagopa-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_pagopa_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - pagopa" - display_name = "${local.apim_io_backend_api.display_name} - pagopa" - path = "pagopa/api" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/pagopa/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/pagopa/v1/_base_policy.xml") -} -## - -## APP -resource "azurerm_api_management_api_version_set" "io_backend_app_api" { - name = format("%s-io-backend-app-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - app" - versioning_scheme = "Segment" -} - -module "apim_io_backend_app_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-app-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_app_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - app" - display_name = "${local.apim_io_backend_api.display_name} - app" - path = "${local.apim_io_backend_api.path}/app" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/app/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/app/v1/_base_policy.xml") - api_operation_policies = [ - { - operation_id = "getUserMessages" - xml_content = file("./api/io_backend/app/v1/operations/getUserMessages.xml") - } - ] -} -## - -## AUTH -resource "azurerm_api_management_api_version_set" "io_backend_auth_api" { - name = format("%s-io-backend-auth-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - auth" - versioning_scheme = "Segment" -} - -module "apim_io_backend_auth_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-auth-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_auth_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - auth" - display_name = "${local.apim_io_backend_api.display_name} - auth" - path = "${local.apim_io_backend_api.path}/auth" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/auth/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/auth/v1/_base_policy.xml") -} -## - -## BONUS -resource "azurerm_api_management_api_version_set" "io_backend_bonus_api" { - name = format("%s-io-backend-bonus-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - bonus" - versioning_scheme = "Segment" -} - -module "apim_io_backend_bonus_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-bonus-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_bonus_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - bonus" - display_name = "${local.apim_io_backend_api.display_name} - bonus" - path = "${local.apim_io_backend_api.path}/bonus" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/bonus/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/bonus/v1/_base_policy.xml") -} -## - -## CGN -resource "azurerm_api_management_api_version_set" "io_backend_cgn_api" { - name = format("%s-io-backend-cgn-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - cgn" - versioning_scheme = "Segment" -} - -module "apim_io_backend_cgn_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-cgn-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_cgn_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - cgn" - display_name = "${local.apim_io_backend_api.display_name} - cgn" - path = "${local.apim_io_backend_api.path}/cgn" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/cgn/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/cgn/v1/_base_policy.xml") -} -## - -## EUCOVIDCERT -resource "azurerm_api_management_api_version_set" "io_backend_eucovidcert_api" { - name = format("%s-io-backend-eucovidcert-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - eucovidcert" - versioning_scheme = "Segment" -} - -module "apim_io_backend_eucovidcert_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-eucovidcert-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_eucovidcert_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - eucovidcert" - display_name = "${local.apim_io_backend_api.display_name} - eucovidcert" - path = "${local.apim_io_backend_api.path}/eucovidcert" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/eucovidcert/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/eucovidcert/v1/_base_policy.xml") -} -## - -## MITVOUCHER -resource "azurerm_api_management_api_version_set" "io_backend_mitvoucher_api" { - name = format("%s-io-backend-mitvoucher-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - mitvoucher" - versioning_scheme = "Segment" -} - -module "apim_io_backend_mitvoucher_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-mitvoucher-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_mitvoucher_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - mitvoucher" - display_name = "${local.apim_io_backend_api.display_name} - mitvoucher" - path = "${local.apim_io_backend_api.path}/mitvoucher" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/mitvoucher/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/mitvoucher/v1/_base_policy.xml") -} -## - -## NOTIFICATIONS -resource "azurerm_api_management_api_version_set" "io_backend_notifications_api" { - name = format("%s-io-backend-notifications-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - notifications" - versioning_scheme = "Segment" -} - -module "apim_io_backend_notifications_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-notifications-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_notifications_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - notifications" - display_name = "${local.apim_io_backend_api.display_name} - notifications" - path = "${local.apim_io_backend_api.path}/notifications" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/notifications/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/notifications/v1/_base_policy.xml") -} -## - -## PUBLIC -resource "azurerm_api_management_api_version_set" "io_backend_public_api" { - name = format("%s-io-backend-public-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - public" - versioning_scheme = "Segment" -} - -module "apim_io_backend_public_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-public-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_public_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - public" - display_name = "${local.apim_io_backend_api.display_name} - public" - path = "${local.apim_io_backend_api.path}/public" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/public/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/public/v1/_base_policy.xml") -} -## - -## SESSION -resource "azurerm_api_management_api_version_set" "io_backend_session_api" { - name = format("%s-io-backend-session-api", var.env_short) - resource_group_name = module.apim.resource_group_name - api_management_name = module.apim.name - display_name = "${local.apim_io_backend_api.display_name} - session" - versioning_scheme = "Segment" -} - -module "apim_io_backend_session_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = format("%s-io-backend-session-api", var.env_short) - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_io_backend_product.product_id] - subscription_required = local.apim_io_backend_api.subscription_required - version_set_id = azurerm_api_management_api_version_set.io_backend_session_api.id - api_version = "v1" - service_url = local.apim_io_backend_api.service_url - - description = "${local.apim_io_backend_api.description} - session" - display_name = "${local.apim_io_backend_api.display_name} - session" - path = "${local.apim_io_backend_api.path}/session" - protocols = ["https"] - - content_format = "swagger-json" - content_value = templatefile("./api/io_backend/session/v1/_swagger.json.tpl", { - host = local.apim_hostname_api_app_internal # api-app.internal.io.pagopa.it - }) - - xml_content = file("./api/io_backend/session/v1/_base_policy.xml") -} -## diff --git a/src/core/apim_io_public_api.tf b/src/core/apim_io_public_api.tf deleted file mode 100644 index 678f209f5..000000000 --- a/src/core/apim_io_public_api.tf +++ /dev/null @@ -1,65 +0,0 @@ -module "apim_product_public" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" - - product_id = "io-public-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "IO PUBLIC API" - description = "PUBLIC API for IO platform." - subscription_required = false - approval_required = false - published = true - - policy_xml = file("./api_product/io_public/_base_policy.xml") -} - -# Named Value io_fn3_public_url -resource "azurerm_api_management_named_value" "io_fn3_public_url" { - name = "io-fn3-public-url" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-public-url" - value = "https://io-p-public-fn.azurewebsites.net" -} - -data "azurerm_key_vault_secret" "io_fn3_public_key_secret" { - name = "fn3public-KEY-APIM" - key_vault_id = module.key_vault_common.id -} - -resource "azurerm_api_management_named_value" "io_fn3_public_key" { - name = "io-fn3-public-key" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-public-key" - value = data.azurerm_key_vault_secret.io_fn3_public_key_secret.value - secret = "true" -} - -module "api_public" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = "io-public-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - revision = "1" - display_name = "IO PUBLIC API" - description = "PUBLIC API for IO platform." - - path = "public" - protocols = ["https"] - product_ids = [module.apim_product_public.product_id] - - service_url = null - - subscription_required = false - - content_format = "swagger-json" - content_value = templatefile("./api/io_public/v1/_swagger.json.tpl", - { - host = "api.io.pagopa.it" - } - ) - - xml_content = file("./api/io_public/v1/policy.xml") -} diff --git a/src/core/apim_io_services_api.tf b/src/core/apim_io_services_api.tf deleted file mode 100644 index bf9468bcc..000000000 --- a/src/core/apim_io_services_api.tf +++ /dev/null @@ -1,123 +0,0 @@ -module "apim_product_services" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" - - product_id = "io-services-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "IO SERVICES API" - description = "SERVICES API for IO platform." - subscription_required = true - approval_required = false - published = true - - policy_xml = file("./api_product/io_services/_base_policy.xml") -} - -resource "azurerm_api_management_api_operation_policy" "submit_message_for_user_policy" { - api_name = "io-services-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - operation_id = "submitMessageforUser" - - xml_content = file("./api/io_services/v1/post_submitmessageforuser_policy/policy.xml") -} - -resource "azurerm_api_management_api_operation_policy" "submit_message_for_user_with_fiscalcode_in_body_policy" { - api_name = "io-services-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - operation_id = "submitMessageforUserWithFiscalCodeInBody" - - xml_content = file("./api/io_services/v1/post_submitmessageforuserwithfiscalcodeinbody_policy/policy.xml") -} - -# Named Value fn3-services -resource "azurerm_api_management_named_value" "io_fn3_services_url" { - name = "io-fn3-services-url" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-services-url" - value = "https://io-p-fn3-services.azurewebsites.net" -} - -data "azurerm_key_vault_secret" "io_fn3_services_key_secret" { - name = "fn3services-KEY-APIM" - key_vault_id = module.key_vault_common.id -} - -resource "azurerm_api_management_named_value" "io_fn3_services_key" { - name = "io-fn3-services-key" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-services-key" - value = data.azurerm_key_vault_secret.io_fn3_services_key_secret.value - secret = "true" -} - -# Named value fn3-eucovidcert - -data "azurerm_key_vault_secret" "io_fn3_eucovidcert_key_secret" { - name = "io-fn3-eucovidcert-KEY-APIM" - key_vault_id = module.key_vault_common.id -} - -resource "azurerm_api_management_named_value" "io_fn3_eucovidcert_key" { - name = "io-fn3-eucovidcert-key" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-eucovidcert-key" - value = data.azurerm_key_vault_secret.io_fn3_eucovidcert_key_secret.value - secret = "true" -} - -# alternative url, for differential routing (example: progressive rollout) -resource "azurerm_api_management_named_value" "io_fn3_eucovidcert_url_alt" { - name = "io-fn3-eucovidcert-url-alt" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn3-eucovidcert-url-alt" - value = "https://io-p-eucovidcert-fn.azurewebsites.net" -} - -# Named Value api gad certificate header -data "azurerm_key_vault_secret" "api_gad_client_certificate_verified_header_secret" { - name = "apigad-GAD-CLIENT-CERTIFICATE-VERIFIED-HEADER" - key_vault_id = module.key_vault_common.id -} - -resource "azurerm_api_management_named_value" "api_gad_client_certificate_verified_header" { - name = "apigad-gad-client-certificate-verified-header" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "apigad-gad-client-certificate-verified-header" - value = data.azurerm_key_vault_secret.api_gad_client_certificate_verified_header_secret.value - secret = "true" -} - -module "api_services" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = "io-services-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - revision = "1" - display_name = "IO SERVICES API" - description = "SERVICES API for IO platform." - - path = "api/v1" - protocols = ["http", "https"] - product_ids = [module.apim_product_services.product_id] - - service_url = null - - subscription_required = true - - content_format = "swagger-json" - content_value = templatefile("./api/io_services/v1/_swagger.json.tpl", - { - host = "api.io.pagopa.it" - } - ) - - xml_content = file("./api/io_services/v1/policy.xml") -} diff --git a/src/core/apim_v2.tf b/src/core/apim_v2.tf index e4b13be0c..6ef16f70a 100644 --- a/src/core/apim_v2.tf +++ b/src/core/apim_v2.tf @@ -1,3 +1,18 @@ +data "azurerm_key_vault_secret" "apim_publisher_email" { + name = "apim-publisher-email" + key_vault_id = module.key_vault.id +} + +data "azurerm_key_vault_certificate" "api_internal_io_italia_it" { + name = replace(local.apim_hostname_api_internal, ".", "-") + key_vault_id = module.key_vault_common.id +} + +data "azurerm_key_vault_certificate" "api_app_internal_io_pagopa_it" { + name = replace(local.apim_hostname_api_app_internal, ".", "-") + key_vault_id = module.key_vault.id +} + # APIM subnet module "apim_v2_snet" { source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet?ref=v4.1.15" @@ -269,4 +284,4 @@ resource "azurerm_api_management_subscription" "pn_lc_subscription_v2" { state = "active" allow_tracing = false } -################################################################## \ No newline at end of file +################################################################## diff --git a/src/core/apim_v2_cgn.tf b/src/core/apim_v2_cgn.tf index fd67329c7..6a43fce19 100644 --- a/src/core/apim_v2_cgn.tf +++ b/src/core/apim_v2_cgn.tf @@ -1,3 +1,13 @@ +data "azurerm_key_vault_secret" "cgnonboardingportal_os_key" { + name = "funccgn-KEY-CGNOS" + key_vault_id = module.key_vault_common.id +} + +data "azurerm_key_vault_secret" "cgnonboardingportal_os_header_name" { + name = "funccgn-KEY-CGNOSHEADERNAME" + key_vault_id = module.key_vault_common.id +} + ## Api merchant module "apim_v2_product_merchant" { source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" diff --git a/src/core/app_backend.tf b/src/core/app_backend.tf index 5b34bed96..cbb51427a 100644 --- a/src/core/app_backend.tf +++ b/src/core/app_backend.tf @@ -92,7 +92,7 @@ locals { ALLOW_NOTIFY_IP_SOURCE_RANGE = "127.0.0.0/0" // LOCK / UNLOCK SESSION ENDPOINTS - ALLOW_SESSION_HANDLER_IP_SOURCE_RANGE = module.apim_snet.address_prefixes[0] + ALLOW_SESSION_HANDLER_IP_SOURCE_RANGE = module.apim_v2_snet.address_prefixes[0] // PAGOPA PAGOPA_API_URL_PROD = "https://api.platform.pagopa.it/checkout/auth/payments/v1" @@ -638,7 +638,6 @@ module "appservice_app_backendl1" { module.services_snet[0].id, module.services_snet[1].id, module.appgateway_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -681,7 +680,6 @@ module "appservice_app_backendl1_slot_staging" { module.services_snet[0].id, module.services_snet[1].id, module.appgateway_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -858,7 +856,6 @@ module "appservice_app_backendl2" { module.services_snet[0].id, module.services_snet[1].id, module.appgateway_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -901,7 +898,6 @@ module "appservice_app_backendl2_slot_staging" { module.services_snet[0].id, module.services_snet[1].id, module.appgateway_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/app_messages.tf b/src/core/app_messages.tf index f0dd01568..920595c42 100644 --- a/src/core/app_messages.tf +++ b/src/core/app_messages.tf @@ -181,7 +181,6 @@ module "app_messages_function" { module.app_messages_snet[count.index].id, module.app_backendl1_snet.id, module.app_backendl2_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/cgn.tf b/src/core/cgn.tf index 847fd2c02..652222fe4 100644 --- a/src/core/cgn.tf +++ b/src/core/cgn.tf @@ -228,72 +228,72 @@ resource "azurerm_private_endpoint" "cgn_legalbackup_storage" { } } -## Api merchant -module "apim_product_merchant" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" +# ## Api merchant +# module "apim_product_merchant" { +# source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.15" - product_id = "cgnmerchant" - display_name = "IO CGN API MERCHANT" - description = "Product for CGN Merchant Api" +# product_id = "cgnmerchant" +# display_name = "IO CGN API MERCHANT" +# description = "Product for CGN Merchant Api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name +# api_management_name = module.apim.name +# resource_group_name = module.apim.resource_group_name - published = true - subscription_required = true - approval_required = false +# published = true +# subscription_required = true +# approval_required = false - policy_xml = file("./api_product/cgn/_base_policy.xml") -} - -module "api_cgn_merchant" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" - - name = "io-cgn-merchant-api" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - product_ids = [module.apim_product_merchant.product_id] - service_url = local.apim_io_backend_api.service_url - - description = "CGN MERCHANT API for IO platform." - display_name = "IO CGN MERCHANT API" - path = "api/v1/merchant/cgn" - protocols = ["https"] - revision = "1" - subscription_required = true - - content_format = "swagger-json" - content_value = templatefile("./api/cgn/v1/_swagger.json.tpl", - { - host = "api.io.italia.it" - } - ) +# policy_xml = file("./api_product/cgn/_base_policy.xml") +# } - xml_content = file("./api/cgn/v1/_base_policy.xml") -} +# module "api_cgn_merchant" { +# source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.15" + +# name = "io-cgn-merchant-api" +# api_management_name = module.apim.name +# resource_group_name = module.apim.resource_group_name +# product_ids = [module.apim_product_merchant.product_id] +# service_url = local.apim_io_backend_api.service_url + +# description = "CGN MERCHANT API for IO platform." +# display_name = "IO CGN MERCHANT API" +# path = "api/v1/merchant/cgn" +# protocols = ["https"] +# revision = "1" +# subscription_required = true + +# content_format = "swagger-json" +# content_value = templatefile("./api/cgn/v1/_swagger.json.tpl", +# { +# host = "api.io.italia.it" +# } +# ) + +# xml_content = file("./api/cgn/v1/_base_policy.xml") +# } -# Named Values function-cgn-merchant -resource "azurerm_api_management_named_value" "io_fn_cgnmerchant_url" { - name = "io-fn-cgnmerchant-url" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn-cgnmerchant-url" - value = "https://${module.function_cgn_merchant.default_hostname}" -} +# # Named Values function-cgn-merchant +# resource "azurerm_api_management_named_value" "io_fn_cgnmerchant_url" { +# name = "io-fn-cgnmerchant-url" +# api_management_name = module.apim.name +# resource_group_name = module.apim.resource_group_name +# display_name = "io-fn-cgnmerchant-url" +# value = "https://${module.function_cgn_merchant.default_hostname}" +# } -data "azurerm_key_vault_secret" "io_fn_cgnmerchant_key_secret" { - name = "io-fn-cgnmerchant-KEY-APIM" - key_vault_id = module.key_vault_common.id -} +# data "azurerm_key_vault_secret" "io_fn_cgnmerchant_key_secret" { +# name = "io-fn-cgnmerchant-KEY-APIM" +# key_vault_id = module.key_vault_common.id +# } -resource "azurerm_api_management_named_value" "io_fn_cgnmerchant_key" { - name = "io-fn-cgnmerchant-key" - api_management_name = module.apim.name - resource_group_name = module.apim.resource_group_name - display_name = "io-fn-cgnmerchant-key" - value = data.azurerm_key_vault_secret.io_fn_cgnmerchant_key_secret.value - secret = "true" -} +# resource "azurerm_api_management_named_value" "io_fn_cgnmerchant_key" { +# name = "io-fn-cgnmerchant-key" +# api_management_name = module.apim.name +# resource_group_name = module.apim.resource_group_name +# display_name = "io-fn-cgnmerchant-key" +# value = data.azurerm_key_vault_secret.io_fn_cgnmerchant_key_secret.value +# secret = "true" +# } ## App registration for cgn backend portal ## diff --git a/src/core/env/prod/terraform.tfvars b/src/core/env/prod/terraform.tfvars index 5d9140b77..ef8f4c5be 100644 --- a/src/core/env/prod/terraform.tfvars +++ b/src/core/env/prod/terraform.tfvars @@ -102,7 +102,6 @@ redis_common = { # apim apim_publisher_name = "IO" -apim_sku = "Premium_1" apim_v2_sku = "Premium_2" apim_autoscale = { enabled = true diff --git a/src/core/function_admin.tf b/src/core/function_admin.tf index 3b6a20ba5..3071a094f 100644 --- a/src/core/function_admin.tf +++ b/src/core/function_admin.tf @@ -221,7 +221,6 @@ module "function_admin" { allowed_subnets = [ module.admin_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -269,7 +268,6 @@ module "function_admin_staging_slot" { allowed_subnets = [ module.admin_snet.id, module.azdoa_snet[0].id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/function_cgn.tf b/src/core/function_cgn.tf index b73173244..2d39af54b 100644 --- a/src/core/function_cgn.tf +++ b/src/core/function_cgn.tf @@ -134,7 +134,6 @@ module "function_cgn" { module.app_backendl1_snet.id, module.app_backendl2_snet.id, module.app_backendli_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -179,7 +178,6 @@ module "function_cgn_staging_slot" { module.app_backendl1_snet.id, module.app_backendl2_snet.id, module.app_backendli_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/function_cgn_merchant.tf b/src/core/function_cgn_merchant.tf index e4f45fe82..e9573d860 100644 --- a/src/core/function_cgn_merchant.tf +++ b/src/core/function_cgn_merchant.tf @@ -61,7 +61,6 @@ module "function_cgn_merchant" { allowed_subnets = [ module.cgn_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -97,7 +96,6 @@ module "function_cgn_merchant_staging_slot" { allowed_subnets = [ module.cgn_snet.id, module.azdoa_snet[0].id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/function_eucovidcert.tf b/src/core/function_eucovidcert.tf index 1c811e3a3..f58373808 100644 --- a/src/core/function_eucovidcert.tf +++ b/src/core/function_eucovidcert.tf @@ -217,7 +217,6 @@ module "function_eucovidcert" { module.app_backendl1_snet.id, module.app_backendl2_snet.id, module.function_pblevtdispatcher_snetout.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -259,7 +258,6 @@ module "function_eucovidcert_staging_slot" { module.app_backendl1_snet.id, module.app_backendl2_snet.id, module.function_pblevtdispatcher_snetout.id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/function_messages_cqrs.tf b/src/core/function_messages_cqrs.tf index 63c3e2c91..32dcc2dab 100644 --- a/src/core/function_messages_cqrs.tf +++ b/src/core/function_messages_cqrs.tf @@ -167,7 +167,6 @@ module "function_messages_cqrs" { allowed_subnets = [ module.function_messages_cqrs_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/function_public.tf b/src/core/function_public.tf index 4afd64ce7..6d4f5ef00 100644 --- a/src/core/function_public.tf +++ b/src/core/function_public.tf @@ -67,7 +67,6 @@ module "function_public" { allowed_subnets = [ module.shared_1_snet.id, - module.apim_snet.id, module.apim_v2_snet.id, ] @@ -111,7 +110,6 @@ module "function_public_staging_slot" { allowed_subnets = [ module.shared_1_snet.id, module.azdoa_snet[0].id, - module.apim_snet.id, module.apim_v2_snet.id, ] diff --git a/src/core/function_services.tf b/src/core/function_services.tf index c33dc25e6..6200a04eb 100644 --- a/src/core/function_services.tf +++ b/src/core/function_services.tf @@ -234,7 +234,6 @@ module "function_services" { allowed_subnets = [ module.services_snet[count.index].id, module.azdoa_snet[0].id, - module.apim_snet.id, module.apim_v2_snet.id, module.function_eucovidcert_snet.id, ] @@ -291,7 +290,6 @@ module "function_services_staging_slot" { allowed_subnets = [ module.services_snet[count.index].id, module.azdoa_snet[0].id, - module.apim_snet.id, module.apim_v2_snet.id, module.function_eucovidcert_snet.id, ] diff --git a/src/core/network.tf b/src/core/network.tf index 3770d6772..47f1ea809 100644 --- a/src/core/network.tf +++ b/src/core/network.tf @@ -124,3 +124,18 @@ module "private_endpoints_subnet" { private_endpoint_network_policies_enabled = false } + +# TODO OLD APIM subnet to REMOVE +module "apim_snet" { + source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet?ref=v4.1.15" + name = "apimapi" + resource_group_name = azurerm_resource_group.rg_common.name + virtual_network_name = module.vnet_common.name + address_prefixes = var.cidr_subnet_apim + + private_endpoint_network_policies_enabled = true + + service_endpoints = [ + "Microsoft.Web", + ] +} \ No newline at end of file diff --git a/src/domains/citizen-auth-app/01_network.tf b/src/domains/citizen-auth-app/01_network.tf index bf647e961..9b111fcfd 100644 --- a/src/domains/citizen-auth-app/01_network.tf +++ b/src/domains/citizen-auth-app/01_network.tf @@ -75,12 +75,6 @@ data "azurerm_subnet" "ioweb_profile_snet" { resource_group_name = local.vnet_common_resource_group_name } -data "azurerm_subnet" "apim_snet" { - name = "apimapi" - virtual_network_name = local.vnet_common_name - resource_group_name = local.vnet_common_resource_group_name -} - data "azurerm_subnet" "apim_v2_snet" { name = "apimv2api" virtual_network_name = local.vnet_common_name diff --git a/src/domains/citizen-auth-app/04_fims.tf b/src/domains/citizen-auth-app/04_fims.tf index 5d2890f91..e804536cf 100644 --- a/src/domains/citizen-auth-app/04_fims.tf +++ b/src/domains/citizen-auth-app/04_fims.tf @@ -135,7 +135,6 @@ module "appservice_fims_plus" { allowed_subnets = [ data.azurerm_subnet.appgateway_snet.id, - data.azurerm_subnet.apim_snet.id, data.azurerm_subnet.apim_v2_snet.id, ] @@ -173,7 +172,6 @@ module "appservice_fims_plus_slot_staging" { allowed_subnets = [ data.azurerm_subnet.azdoa_snet[0].id, data.azurerm_subnet.appgateway_snet.id, - data.azurerm_subnet.apim_snet.id, data.azurerm_subnet.apim_v2_snet.id, ] @@ -388,7 +386,6 @@ module "appservice_fims" { allowed_subnets = [ data.azurerm_subnet.appgateway_snet.id, - data.azurerm_subnet.apim_snet.id, data.azurerm_subnet.apim_v2_snet.id, ] @@ -426,7 +423,6 @@ module "appservice_fims_slot_staging" { allowed_subnets = [ data.azurerm_subnet.azdoa_snet[0].id, data.azurerm_subnet.appgateway_snet.id, - data.azurerm_subnet.apim_snet.id, data.azurerm_subnet.apim_v2_snet.id, ] diff --git a/src/domains/citizen-auth-app/04_function_lollipop.tf b/src/domains/citizen-auth-app/04_function_lollipop.tf index dc3edafe7..fbe19f086 100644 --- a/src/domains/citizen-auth-app/04_function_lollipop.tf +++ b/src/domains/citizen-auth-app/04_function_lollipop.tf @@ -1,5 +1,5 @@ data "azurerm_key_vault_secret" "first_lollipop_consumer_subscription_key" { - name = "first-lollipop-consumer-pagopa-subscription-key" + name = "first-lollipop-consumer-pagopa-subscription-key-v2" key_vault_id = data.azurerm_key_vault.kv.id } @@ -124,7 +124,6 @@ module "function_lollipop" { allowed_subnets = [ module.lollipop_snet[0].id, - data.azurerm_subnet.apim_snet.id, data.azurerm_subnet.apim_v2_snet.id, data.azurerm_subnet.app_backend_l1_snet.id, data.azurerm_subnet.app_backend_l2_snet.id, @@ -171,7 +170,6 @@ module "function_lollipop_staging_slot" { allowed_subnets = [ module.lollipop_snet[0].id, data.azurerm_subnet.azdoa_snet[0].id, - data.azurerm_subnet.apim_snet.id, data.azurerm_subnet.apim_v2_snet.id, data.azurerm_subnet.app_backend_l1_snet.id, data.azurerm_subnet.app_backend_l2_snet.id, diff --git a/src/domains/citizen-auth-app/07_function_fast_login.tf b/src/domains/citizen-auth-app/07_function_fast_login.tf index 4d4155ea6..53a620ab5 100644 --- a/src/domains/citizen-auth-app/07_function_fast_login.tf +++ b/src/domains/citizen-auth-app/07_function_fast_login.tf @@ -1,5 +1,5 @@ data "azurerm_key_vault_secret" "fast_login_subscription_key" { - name = "fast-login-subscription-key" + name = "fast-login-subscription-key-v2" key_vault_id = data.azurerm_key_vault.kv.id } diff --git a/src/domains/citizen-auth-app/README.md b/src/domains/citizen-auth-app/README.md index 2f4c1e3ca..0dde2412b 100644 --- a/src/domains/citizen-auth-app/README.md +++ b/src/domains/citizen-auth-app/README.md @@ -79,7 +79,6 @@ | [azurerm_resource_group.monitor_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source | | [azurerm_storage_account.lollipop_assertion_storage](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account) | data source | | [azurerm_storage_account.lv_audit_logs_storage](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account) | data source | -| [azurerm_subnet.apim_snet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subnet) | data source | | [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 | diff --git a/src/domains/citizen-auth-common/03_apim.tf b/src/domains/citizen-auth-common/03_apim.tf deleted file mode 100644 index e91d2a794..000000000 --- a/src/domains/citizen-auth-common/03_apim.tf +++ /dev/null @@ -1,137 +0,0 @@ -data "azurerm_api_management" "apim_api" { - name = local.apim_name - resource_group_name = local.apim_resource_group_name -} - -#################################################################################### -# Lollipop APIM Product -#################################################################################### -resource "azurerm_api_management_group" "api_lollipop_assertion_read" { - name = "apilollipopassertionread" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiLollipopAssertionRead" - description = "A group that enables LC to retrieve user's assertion on a Lollipop flow" -} - -module "apim_product_lollipop" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3//api_management_product?ref=v4.1.5" - - product_id = "io-lollipop-api" - display_name = "IO LOLLIPOP API" - description = "Product for IO Lollipop" - - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/io_lollipop/_base_policy.xml") -} - -module "apim_lollipop_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api?ref=v4.1.5" - - name = format("%s-lollipop-api", local.product) - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_ids = [module.apim_product_lollipop.product_id] - subscription_required = true - service_url = null - - description = "IO LolliPOP API" - display_name = "IO LolliPOP API" - path = "lollipop/api/v1" - protocols = ["https"] - - content_format = "openapi" - - content_value = file("./api/io_lollipop/v1/_openapi.yaml") - - xml_content = file("./api/io_lollipop/v1/policy.xml") -} - -# Named Value fn-lollipop -resource "azurerm_api_management_named_value" "io_fn_weu_lollipop_url" { - name = "io-fn-weu-lollipop-url" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-fn-weu-lollipop-url" - value = "https://io-p-weu-lollipop-fn.azurewebsites.net" -} - -data "azurerm_key_vault_secret" "io_fn_weu_lollipop_key_secret" { - name = "io-fn-weu-lollipop-KEY-APIM" - key_vault_id = module.key_vault.id -} - -resource "azurerm_api_management_named_value" "io_fn_weu_lollipop_key" { - name = "io-fn-weu-lollipop-key" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-fn-weu-lollipop-key" - value = data.azurerm_key_vault_secret.io_fn_weu_lollipop_key_secret.value - secret = "true" -} - -#################################################################################### -# PagoPA General Lollipop User -#################################################################################### -resource "azurerm_api_management_user" "pagopa_user" { - user_id = "iolollipoppagopauser" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - first_name = "PagoPA" - last_name = "PagoPA" - email = "io-lollipop-pagopa@pagopa.it" - state = "active" -} - -resource "azurerm_api_management_group_user" "pagopa_group" { - user_id = azurerm_api_management_user.pagopa_user.user_id - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - group_name = azurerm_api_management_group.api_lollipop_assertion_read.name -} - -resource "azurerm_api_management_subscription" "pagopa" { - user_id = azurerm_api_management_user.pagopa_user.id - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_id = module.apim_product_lollipop.id - display_name = "Lollipop API" - state = "active" - allow_tracing = false -} - -resource "azurerm_api_management_subscription" "pagopa_fastlogin" { - user_id = azurerm_api_management_user.pagopa_user.id - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_id = module.apim_product_lollipop.id - display_name = "Fast Login LC" - state = "active" - allow_tracing = false -} - -#################################################################################### -# PagoPA General Lollipop Secret -#################################################################################### -resource "azurerm_key_vault_secret" "first_lollipop_consumer_subscription_key" { - name = "first-lollipop-consumer-pagopa-subscription-key" - value = azurerm_api_management_subscription.pagopa.primary_key - key_vault_id = module.key_vault.id -} - -#################################################################################### -# PagoPA Functions-fast-login Secrets -#################################################################################### - -# subscription key used for assertion retrieval -resource "azurerm_key_vault_secret" "fast_login_subscription_key" { - name = "fast-login-subscription-key" - value = azurerm_api_management_subscription.pagopa_fastlogin.primary_key - key_vault_id = module.key_vault.id -} \ No newline at end of file diff --git a/src/domains/citizen-auth-common/99_locals.tf b/src/domains/citizen-auth-common/99_locals.tf index 86de9b65d..b0baa1b17 100644 --- a/src/domains/citizen-auth-common/99_locals.tf +++ b/src/domains/citizen-auth-common/99_locals.tf @@ -11,7 +11,6 @@ locals { acr_name = replace("${local.product}commonacr", "-", "") acr_resource_group_name = "${local.product}-container-registry-rg" - apim_name = "${local.product}-apim-api" apim_v2_name = "${local.product}-apim-v2-api" apim_resource_group_name = "${local.product}-rg-internal" diff --git a/src/domains/citizen-auth-common/README.md b/src/domains/citizen-auth-common/README.md index be459dbdf..f8ccc714b 100644 --- a/src/domains/citizen-auth-common/README.md +++ b/src/domains/citizen-auth-common/README.md @@ -12,8 +12,6 @@ | Name | Source | Version | |------|--------|---------| -| [apim\_lollipop\_api\_v1](#module\_apim\_lollipop\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v4.1.5 | -| [apim\_product\_lollipop](#module\_apim\_product\_lollipop) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_product | v4.1.5 | | [apim\_v2\_lollipop\_api\_v1](#module\_apim\_v2\_lollipop\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v4.1.5 | | [apim\_v2\_product\_lollipop](#module\_apim\_v2\_product\_lollipop) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_product | v4.1.5 | | [cosmosdb\_account](#module\_cosmosdb\_account) | git::https://github.com/pagopa/terraform-azurerm-v3//cosmosdb_account | v4.3.1 | @@ -31,19 +29,12 @@ | Name | Type | |------|------| -| [azurerm_api_management_group.api_lollipop_assertion_read](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.api_lollipop_assertion_read_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group_user.pagopa_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | | [azurerm_api_management_group_user.pagopa_group_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | -| [azurerm_api_management_named_value.io_fn_weu_lollipop_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn_weu_lollipop_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_named_value.io_fn_weu_lollipop_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | | [azurerm_api_management_named_value.io_fn_weu_lollipop_url_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource | -| [azurerm_api_management_subscription.pagopa](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | -| [azurerm_api_management_subscription.pagopa_fastlogin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | | [azurerm_api_management_subscription.pagopa_fastlogin_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | | [azurerm_api_management_subscription.pagopa_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | -| [azurerm_api_management_user.pagopa_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_user) | resource | | [azurerm_api_management_user.pagopa_user_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_user) | resource | | [azurerm_cosmosdb_mongo_database.db_fims](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cosmosdb_mongo_database) | resource | | [azurerm_cosmosdb_sql_container.fims_client](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cosmosdb_sql_container) | resource | @@ -59,9 +50,7 @@ | [azurerm_key_vault_certificate.lollipop_certificate_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_certificate) | resource | | [azurerm_key_vault_secret.appinsights_connection_string](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.appinsights_instrumentation_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | -| [azurerm_key_vault_secret.fast_login_subscription_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.fast_login_subscription_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | -| [azurerm_key_vault_secret.first_lollipop_consumer_subscription_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.first_lollipop_consumer_subscription_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_monitor_metric_alert.cosmosdb_account_normalized_RU_consumption_exceeded](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_metric_alert) | resource | | [azurerm_private_endpoint.lollipop_assertion_storage_blob](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/private_endpoint) | resource | @@ -79,11 +68,9 @@ | [azuread_service_principal.github_action_iac_cd](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | | [azuread_service_principal.github_action_iac_ci](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | | [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | -| [azurerm_api_management.apim_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source | | [azurerm_api_management.apim_v2_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source | | [azurerm_application_insights.application_insights](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/application_insights) | data source | | [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source | -| [azurerm_key_vault_secret.io_fn_weu_lollipop_key_secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.io_fn_weu_lollipop_key_secret_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.mongodb_connection_string_fims](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_log_analytics_workspace.log_analytics](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/log_analytics_workspace) | data source | diff --git a/src/domains/messages-common/05_apim.tf b/src/domains/messages-common/05_apim.tf deleted file mode 100644 index a87a7f90e..000000000 --- a/src/domains/messages-common/05_apim.tf +++ /dev/null @@ -1,179 +0,0 @@ -data "azurerm_api_management" "apim_api" { - name = local.apim_name - resource_group_name = local.apim_resource_group_name -} - -resource "azurerm_api_management_group" "apithirdpartymessagewrite" { - name = "apithirdpartymessagewrite" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiThirdPartyMessageWrite" - description = "A group that enables to send Third Party Messages" -} - -resource "azurerm_api_management_group" "apimessagewriteadvanced" { - name = "apimessagewriteadvanced" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiMessageWriteAdvanced" - description = "A group that enables to send Advanced Write Messages" -} - -resource "azurerm_api_management_group" "apimessagereadadvanced" { - name = "apimessagereadadvanced" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiMessageReadAdvanced" - description = "A group that enables to send Advanced Read Messages" -} - -resource "azurerm_api_management_group" "apinewmessagenotify" { - name = "apinewmessagenotify" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiNewMessageNotify" - description = "A group that enables to send a Push notification for a new message" -} - -resource "azurerm_api_management_group" "apiremindernotify" { - name = "apiremindernotify" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiReminderNotify" - description = "A group that enables to send a Push notification for a reminder message" -} - -resource "azurerm_api_management_group" "apipaymentupdater" { - name = "apipaymentread" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "ApiPaymentRead" - description = "A group that enables to read payment status related to a message" -} - -module "apim_product_notifications" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3//api_management_product?ref=v4.1.5" - - product_id = "io-notifications-api" - display_name = "IO NOTIFICATIONS API" - description = "Product for IO notifications" - - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/messages/_base_policy.xml") -} - -module "apim_service_messages_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api?ref=v4.1.5" - - name = format("%s-service-messages-api", local.product) - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_ids = [module.apim_product_notifications.product_id] - subscription_required = true - service_url = null - - description = "IO Service - Messages API" - display_name = "IO Service - Messages API" - path = "service-messages/api/v1" - protocols = ["https"] - - content_format = "openapi" - - content_value = file("./api/service-messages/v1/_openapi.yaml") - - xml_content = file("./api/service-messages/v1/_base_policy.xml") -} - -module "io-backend_notification_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api?ref=v4.1.5" - - name = format("%s-io-backend-notification-api", local.product) - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_ids = [module.apim_product_notifications.product_id] - subscription_required = false - service_url = null - - description = "IO Backend - Notification API" - display_name = "IO Backend - Notification API" - path = "io-backend-notification/api/v1" - protocols = ["https"] - - content_format = "openapi" - - content_value = file("./api/io-backend-notification/v1/_openapi.yaml") - - xml_content = file("./api/io-backend-notification/v1/_base_policy.xml") -} - -resource "azurerm_api_management_user" "reminder_user" { - user_id = "iopremiumreminderuser" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - first_name = "Reminder" - last_name = "Reminder" - email = "io-premium-reminder@pagopa.it" - state = "active" -} - -resource "azurerm_api_management_group_user" "reminder_group" { - user_id = azurerm_api_management_user.reminder_user.user_id - group_name = azurerm_api_management_group.apiremindernotify.name - resource_group_name = azurerm_api_management_user.reminder_user.resource_group_name - api_management_name = azurerm_api_management_user.reminder_user.api_management_name -} - -resource "azurerm_api_management_subscription" "reminder" { - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - user_id = azurerm_api_management_user.reminder_user.id - product_id = module.apim_product_notifications.id - display_name = "Reminder API" - state = "active" - allow_tracing = false -} - -resource "azurerm_key_vault_secret" "reminder_subscription_primary_key" { - name = "${format("%s-reminder", local.product)}-subscription-key" - value = azurerm_api_management_subscription.reminder.primary_key - content_type = "subscription key" - key_vault_id = module.key_vault.id -} - -######################################## - -data "azurerm_api_management_product" "payment_updater_product" { - product_id = "io-payments-api" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name -} - -resource "azurerm_api_management_group_user" "payment_group" { - user_id = azurerm_api_management_user.reminder_user.user_id - group_name = azurerm_api_management_group.apipaymentupdater.name - resource_group_name = azurerm_api_management_user.reminder_user.resource_group_name - api_management_name = azurerm_api_management_user.reminder_user.api_management_name -} - -resource "azurerm_api_management_subscription" "payment_updater_reminder" { - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - user_id = azurerm_api_management_user.reminder_user.id - product_id = data.azurerm_api_management_product.payment_updater_product.id - display_name = "Payment Updater API" - state = "active" - allow_tracing = false -} - -resource "azurerm_key_vault_secret" "reminder_paymentapi_subscription_primary_key" { - name = "${format("%s-reminder-payment-api", local.product)}-subscription-key" - value = azurerm_api_management_subscription.payment_updater_reminder.primary_key - content_type = "subscription key" - key_vault_id = module.key_vault.id -} diff --git a/src/domains/messages-common/99_locals.tf b/src/domains/messages-common/99_locals.tf index 8a3a62363..a364eb9b8 100644 --- a/src/domains/messages-common/99_locals.tf +++ b/src/domains/messages-common/99_locals.tf @@ -11,7 +11,6 @@ locals { acr_name = replace("${local.product}commonacr", "-", "") acr_resource_group_name = "${local.product}-container-registry-rg" - apim_name = "${local.product}-apim-api" apim_v2_name = "${local.product}-apim-v2-api" apim_resource_group_name = "${local.product}-rg-internal" } diff --git a/src/domains/messages-common/README.md b/src/domains/messages-common/README.md index d955cacce..62084b767 100644 --- a/src/domains/messages-common/README.md +++ b/src/domains/messages-common/README.md @@ -12,12 +12,9 @@ | Name | Source | Version | |------|--------|---------| -| [apim\_product\_notifications](#module\_apim\_product\_notifications) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_product | v4.1.5 | -| [apim\_service\_messages\_api\_v1](#module\_apim\_service\_messages\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v4.1.5 | | [apim\_v2\_product\_notifications](#module\_apim\_v2\_product\_notifications) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_product | v4.1.5 | | [apim\_v2\_service\_messages\_api\_v1](#module\_apim\_v2\_service\_messages\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v4.1.5 | | [cosmosdb\_account\_mongodb\_reminder](#module\_cosmosdb\_account\_mongodb\_reminder) | git::https://github.com/pagopa/terraform-azurerm-v3//cosmosdb_account | v4.1.5 | -| [io-backend\_notification\_api\_v1](#module\_io-backend\_notification\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v4.1.5 | | [io-backend\_notification\_v2\_api\_v1](#module\_io-backend\_notification\_v2\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3//api_management_api | v4.1.5 | | [key\_vault](#module\_key\_vault) | git::https://github.com/pagopa/terraform-azurerm-v3//key_vault | v4.1.5 | | [mongdb\_collection\_reminder](#module\_mongdb\_collection\_reminder) | git::https://github.com/pagopa/terraform-azurerm-v3//cosmosdb_mongodb_collection | v4.1.5 | @@ -29,27 +26,16 @@ | Name | Type | |------|------| -| [azurerm_api_management_group.apimessagereadadvanced](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.apimessagereadadvanced_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group.apimessagewriteadvanced](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.apimessagewriteadvanced_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group.apinewmessagenotify](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.apinewmessagenotify_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group.apipaymentupdater](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.apipaymentupdater_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group.apiremindernotify](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.apiremindernotify_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group.apithirdpartymessagewrite](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | | [azurerm_api_management_group.apithirdpartymessagewrite_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group) | resource | -| [azurerm_api_management_group_user.payment_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | | [azurerm_api_management_group_user.payment_group_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | -| [azurerm_api_management_group_user.reminder_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | | [azurerm_api_management_group_user.reminder_group_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_group_user) | resource | -| [azurerm_api_management_subscription.payment_updater_reminder](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | | [azurerm_api_management_subscription.payment_updater_reminder_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | -| [azurerm_api_management_subscription.reminder](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | | [azurerm_api_management_subscription.reminder_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_subscription) | resource | -| [azurerm_api_management_user.reminder_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_user) | resource | | [azurerm_api_management_user.reminder_user_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_user) | resource | | [azurerm_cosmosdb_mongo_database.db_reminder](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cosmosdb_mongo_database) | resource | | [azurerm_key_vault_access_policy.adgroup_admin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource | @@ -67,9 +53,7 @@ | [azurerm_key_vault_secret.payments_io-p-payment-updates-weu-prod01-evh-reminder_jaas-connection-string](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.push_notifications_storage_connection_string](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.reminder_mysql_db_server_url](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | -| [azurerm_key_vault_secret.reminder_paymentapi_subscription_primary_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.reminder_paymentapi_subscription_primary_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | -| [azurerm_key_vault_secret.reminder_subscription_primary_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_key_vault_secret.reminder_subscription_primary_key_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource | | [azurerm_mysql_flexible_database.reminder_mysql_db](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mysql_flexible_database) | resource | | [azurerm_mysql_flexible_server.reminder_mysql_server](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mysql_flexible_server) | resource | @@ -84,9 +68,7 @@ | [azuread_group.adgroup_externals](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | | [azuread_group.adgroup_security](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | | [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | -| [azurerm_api_management.apim_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source | | [azurerm_api_management.apim_v2_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source | -| [azurerm_api_management_product.payment_updater_product](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_product) | data source | | [azurerm_api_management_product.payment_updater_product_v2](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management_product) | data source | | [azurerm_application_insights.application_insights](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/application_insights) | data source | | [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source | diff --git a/src/domains/payments-common/05_api.tf b/src/domains/payments-common/05_api.tf deleted file mode 100644 index 342d62597..000000000 --- a/src/domains/payments-common/05_api.tf +++ /dev/null @@ -1,43 +0,0 @@ -data "azurerm_api_management" "apim_api" { - name = local.apim_name - resource_group_name = local.apim_resource_group_name -} - -module "apim_product_payments" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v4.1.8" - - product_id = "io-payments-api" - display_name = "IO PAYMENTS API" - description = "Product for IO payments" - - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/payments/_base_policy.xml") -} - -module "apim_payments_updater_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v4.1.8" - - name = format("%s-payments-updater-api", local.product) - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_ids = [module.apim_product_payments.product_id] - subscription_required = true - service_url = null - - description = "IO Payments - Updater API" - display_name = "IO Payments - Updater API" - path = "api/v1/payment" - protocols = ["https"] - - content_format = "openapi" - - content_value = file("./api/payments_updater/v1/_openapi.yaml") - - xml_content = file("./api/payments_updater/v1/_base_policy.xml") -} diff --git a/src/domains/payments-common/99_locals.tf b/src/domains/payments-common/99_locals.tf index 59f3ba766..e767fbaa9 100644 --- a/src/domains/payments-common/99_locals.tf +++ b/src/domains/payments-common/99_locals.tf @@ -20,7 +20,6 @@ locals { acr_name = replace("${local.product}commonacr", "-", "") acr_resource_group_name = "${local.product}-container-registry-rg" - apim_name = "${local.product}-apim-api" apim_v2_name = "${local.product}-apim-v2-api" apim_resource_group_name = "${local.product}-rg-internal" } diff --git a/src/domains/payments-common/README.md b/src/domains/payments-common/README.md index 2ce187ba4..238aecfad 100644 --- a/src/domains/payments-common/README.md +++ b/src/domains/payments-common/README.md @@ -12,8 +12,6 @@ | Name | Source | Version | |------|--------|---------| -| [apim\_payments\_updater\_api\_v1](#module\_apim\_payments\_updater\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.8 | -| [apim\_product\_payments](#module\_apim\_product\_payments) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.8 | | [apim\_v2\_payments\_updater\_api\_v1](#module\_apim\_v2\_payments\_updater\_api\_v1) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api | v4.1.8 | | [apim\_v2\_product\_payments](#module\_apim\_v2\_product\_payments) | git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product | v4.1.8 | | [cosmosdb\_account\_mongodb](#module\_cosmosdb\_account\_mongodb) | git::https://github.com/pagopa/terraform-azurerm-v3.git//cosmosdb_account | v4.1.8 | @@ -41,7 +39,6 @@ | [azuread_group.adgroup_externals](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | | [azuread_group.adgroup_security](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source | | [azuread_service_principal.platform_iac_sp](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source | -| [azurerm_api_management.apim_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source | | [azurerm_api_management.apim_v2_api](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/api_management) | data source | | [azurerm_application_insights.application_insights](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/application_insights) | data source | | [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config) | data source | diff --git a/src/domains/sign/apim.tf b/src/domains/sign/apim.tf deleted file mode 100644 index f3404f136..000000000 --- a/src/domains/sign/apim.tf +++ /dev/null @@ -1,189 +0,0 @@ -data "azurerm_api_management" "apim_api" { - name = "io-p-apim-api" - resource_group_name = "io-p-rg-internal" -} - -resource "azurerm_api_management_named_value" "io_fn_sign_issuer_url" { - name = "io-fn-sign-issuer-url" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-fn-sign-issuer-url" - value = format("https://%s-sign-issuer-func.azurewebsites.net", local.product) -} - -resource "azurerm_api_management_named_value" "io_fn_sign_issuer_key" { - name = "io-fn-sign-issuer-key" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-fn-sign-issuer-key" - value = module.key_vault_secrets.values["io-fn-sign-issuer-key"].value - secret = true -} - -resource "azurerm_api_management_named_value" "io_fn_sign_support_url" { - name = "io-fn-sign-support-url" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-fn-sign-support-url" - value = format("https://%s-sign-support-func.azurewebsites.net", local.product) -} - -resource "azurerm_api_management_named_value" "io_fn_sign_support_key" { - name = "io-fn-sign-support-key" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-fn-sign-support-key" - value = module.key_vault_secrets.values["io-fn-sign-support-key"].value - secret = true -} - - -resource "azurerm_api_management_named_value" "io_sign_cosmosdb_name" { - name = "io-sign-cosmosdb-name" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-cosmosdb-name" - value = module.cosmosdb_account.name - secret = false -} - -resource "azurerm_api_management_named_value" "io_sign_cosmosdb_key" { - name = "io-sign-cosmosdb-key" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-cosmosdb-key" - value = module.cosmosdb_account.primary_readonly_key - secret = true -} - -resource "azurerm_api_management_named_value" "io_sign_cosmosdb_issuer_container_name" { - name = "io-sign-cosmosdb-issuer-container-name" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-cosmosdb-issuer-container-name" - value = module.cosmosdb_sql_database_issuer.name - secret = false -} - -resource "azurerm_api_management_named_value" "io_sign_cosmosdb_issuer_whitelist_collection_name_new" { - name = "io-sign-cosmosdb-issuer-whitelist-collection-name" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-cosmosdb-issuer-whitelist-collection-name" - value = module.cosmosdb_sql_container_issuer-issuers-whitelist.name - secret = false -} - -resource "azurerm_api_management_named_value" "io_sign_cosmosdb_issuer_issuers_collection_name" { - name = "io-sign-cosmosdb-issuer-issuers-name" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-cosmosdb-issuer-issuers-name" - value = module.cosmosdb_sql_container_issuer-issuers.name - secret = false -} - -resource "azurerm_api_management_named_value" "backoffice-database-name_apimv1" { - name = "io-sign-backoffice-database-name" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-backoffice-database-name" - value = module.cosmosdb_sql_database_backoffice.name - secret = false -} - -resource "azurerm_api_management_named_value" "backoffice-api-keys-collection-name_apimv1" { - name = "io-sign-backoffice-api-keys-collection-name" - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - display_name = "io-sign-backoffice-api-keys-collection-name" - value = module.cosmosdb_sql_container_backoffice-api-keys.name - secret = false -} - -module "apim_io_sign_product" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v6.20.2" - - product_id = "io-sign-api" - display_name = "IO SIGN API" - description = "Product for IO sign" - - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/sign/_base_policy.xml") -} - -resource "azurerm_api_management_api_operation_policy" "get_signer_by_fiscal_code_policy" { - api_name = module.apim_io_sign_issuer_api_v1.name - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - operation_id = "getSignerByFiscalCode" - - xml_content = file("./api/issuer/v1/get_signer_by_fiscal_code_policy/policy.xml") -} - -module "apim_io_sign_issuer_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v6.20.2" - - name = format("%s-sign-issuer-api", local.product) - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_ids = [module.apim_io_sign_product.product_id] - subscription_required = true - service_url = null - - description = "IO Sign - Issuer API" - display_name = "IO Sign - Issuer API" - path = "api/v1/sign" - protocols = ["https"] - - content_format = "openapi" - - content_value = file("./api/issuer/v1/openapi.yaml") - - xml_content = file("./api/issuer/v1/base_policy.xml") -} - -module "apim_io_sign_support_product" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_product?ref=v6.20.2" - - product_id = "io-sign-support-api" - display_name = "IO SIGN SUPPORT Product" - description = "Support Product for IO SIGN" - - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - - published = true - subscription_required = true - approval_required = false - - policy_xml = file("./api_product/support/_base_policy.xml") -} - -module "apim_io_sign_support_api_v1" { - source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//api_management_api?ref=v6.20.2" - - name = format("%s-sign-support-api", local.product) - api_management_name = data.azurerm_api_management.apim_api.name - resource_group_name = data.azurerm_api_management.apim_api.resource_group_name - product_ids = [module.apim_io_sign_support_product.product_id] - subscription_required = true - service_url = null - - description = "IO Sign - Support API" - display_name = "IO Sign - Support API" - path = "api/v1/sign/support" - protocols = ["https"] - - content_format = "openapi" - - content_value = file("./api/support/v1/openapi.yaml") - - xml_content = file("./api/support/v1/base_policy.xml") -} diff --git a/src/domains/sign/io_sign_backoffice_app.tf b/src/domains/sign/io_sign_backoffice_app.tf index c0e2f6f81..285c967f0 100644 --- a/src/domains/sign/io_sign_backoffice_app.tf +++ b/src/domains/sign/io_sign_backoffice_app.tf @@ -5,7 +5,7 @@ locals { COSMOS_DB_NAME = module.cosmosdb_sql_database_backoffice.name APIM_RESOURCE_GROUP_NAME = data.azurerm_api_management.apim_v2_api.resource_group_name, APIM_SERVICE_NAME = data.azurerm_api_management.apim_v2_api.name, - APIM_PRODUCT_NAME = module.apim_io_sign_product.product_id + APIM_PRODUCT_NAME = module.apim_v2_io_sign_product.product_id APPINSIGHTS_INSTRUMENTATIONKEY = sensitive(data.azurerm_application_insights.application_insights.instrumentation_key) }, { diff --git a/src/domains/sign/io_sign_issuer_func.tf b/src/domains/sign/io_sign_issuer_func.tf index 0617e34c5..783fe1140 100644 --- a/src/domains/sign/io_sign_issuer_func.tf +++ b/src/domains/sign/io_sign_issuer_func.tf @@ -70,7 +70,6 @@ module "io_sign_issuer_func" { subnet_id = module.io_sign_snet.id allowed_subnets = [ module.io_sign_snet.id, - data.azurerm_subnet.apim.id, data.azurerm_subnet.apim_v2.id, ] @@ -112,7 +111,6 @@ module "io_sign_issuer_func_staging_slot" { subnet_id = module.io_sign_snet.id allowed_subnets = [ module.io_sign_snet.id, - data.azurerm_subnet.apim.id, data.azurerm_subnet.apim_v2.id, ] diff --git a/src/domains/sign/io_sign_support_func.tf b/src/domains/sign/io_sign_support_func.tf index f6d221f61..cbd6534e1 100644 --- a/src/domains/sign/io_sign_support_func.tf +++ b/src/domains/sign/io_sign_support_func.tf @@ -40,7 +40,6 @@ module "io_sign_support_func" { subnet_id = module.io_sign_support_snet.id allowed_subnets = [ module.io_sign_support_snet.id, - data.azurerm_subnet.apim.id, data.azurerm_subnet.apim_v2.id, ] @@ -76,7 +75,6 @@ module "io_sign_support_func_staging_slot" { subnet_id = module.io_sign_support_snet.id allowed_subnets = [ module.io_sign_support_snet.id, - data.azurerm_subnet.apim.id, data.azurerm_subnet.apim_v2.id, ] diff --git a/src/domains/sign/network.tf b/src/domains/sign/network.tf index 005130de5..0e3aeb750 100644 --- a/src/domains/sign/network.tf +++ b/src/domains/sign/network.tf @@ -9,12 +9,6 @@ data "azurerm_subnet" "private_endpoints_subnet" { resource_group_name = format("%s-rg-common", local.product) } -data "azurerm_subnet" "apim" { - name = "apimapi" - virtual_network_name = format("%s-vnet-common", local.product) - resource_group_name = format("%s-rg-common", local.product) -} - data "azurerm_subnet" "apim_v2" { name = "apimv2api" virtual_network_name = format("%s-vnet-common", local.product)