Skip to content

Commit

Permalink
feat: [PAGOPA-2045] set async request to FdR1 for SFTP requests (#2572)
Browse files Browse the repository at this point in the history
* [PAGOPA-2045] feat: set async request to FdR1 for SFTP requests

* [PAGOPA-2045] fix: optimized flow

* [PAGOPA-2045] chore: reincluded comment

* removed old files, optimized ftp-org variable

* fix fdr-legacy

* use legacy threat protection

* [PAGOPA-2045] fix: changed pointed API on FTP's flow

* [PAGOPA-2045] fix: add conditional presence on FdR3's resources

---------

Co-authored-by: Francesco Cesareo <[email protected]>
Co-authored-by: mamari90 <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2024
1 parent 9b02a52 commit 7cb4bf7
Show file tree
Hide file tree
Showing 23 changed files with 122 additions and 539 deletions.

This file was deleted.

6 changes: 3 additions & 3 deletions src/domains/fdr-app/00_alert_fdr_fase3.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Exception FdR Fase3 - Internal APIs
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_internal_availability" {
count = var.env_short == "p" ? 1 : 0
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
resource_group_name = "dashboards"
name = "fdr-internal-app-exception"
location = var.location
Expand Down Expand Up @@ -37,7 +37,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_internal_avail

# Exception FdR Fase3 - PSP APIs
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_psp_availability" {
count = var.env_short == "p" ? 1 : 0
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
resource_group_name = "dashboards"
name = "fdr-psp-app-exception"
location = var.location
Expand Down Expand Up @@ -74,7 +74,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_psp_availabili

# Exception FdR Fase3 - Organizations APIs
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_org_availability" {
count = var.env_short == "p" ? 1 : 0
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
resource_group_name = "dashboards"
name = "fdr-org-app-exception"
location = var.location
Expand Down
12 changes: 6 additions & 6 deletions src/domains/fdr-app/00_alert_fdr_jsontoxml.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AppException during conversion
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_jsontoxml_appexception" {
count = var.env_short == "p" ? 1 : 0
name = "${module.fdr_json_to_xml_function.name}-app-exception"
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
name = "${module.fdr_json_to_xml_function[0].name}-app-exception"
resource_group_name = data.azurerm_resource_group.fdr_rg.name
location = var.location

Expand All @@ -21,7 +21,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_jsontoxml_appe
| summarize Total=count() by length=bin(timestamp,1m)
| order by length desc
QUERY
, module.fdr_json_to_xml_function.name
, module.fdr_json_to_xml_function[0].name
)
severity = 3
frequency = 15
Expand All @@ -34,8 +34,8 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_jsontoxml_appe

# AppException during conversion (Last retry)
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_jsontoxml_appexception_lastretry" {
count = var.env_short == "p" ? 1 : 0
name = "${module.fdr_json_to_xml_function.name}-app-exception-lastretry"
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
name = "${module.fdr_json_to_xml_function[0].name}-app-exception-lastretry"
resource_group_name = data.azurerm_resource_group.fdr_rg.name
location = var.location

Expand All @@ -55,7 +55,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_jsontoxml_appe
| summarize Total=count() by length=bin(timestamp,1m)
| order by length desc
QUERY
, module.fdr_json_to_xml_function.name
, module.fdr_json_to_xml_function[0].name
)
severity = 1
frequency = 15
Expand Down
12 changes: 6 additions & 6 deletions src/domains/fdr-app/00_alert_fdr_xmltojson.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# AppException during conversion
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_xmltojson_appexception" {
count = var.env_short == "p" ? 1 : 0
name = "${module.fdr_xml_to_json_function.name}-app-exception"
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
name = "${module.fdr_xml_to_json_function[0].name}-app-exception"
resource_group_name = data.azurerm_resource_group.fdr_rg.name
location = var.location

Expand All @@ -21,7 +21,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_xmltojson_appe
| summarize Total=count() by length=bin(timestamp,1m)
| order by length desc
QUERY
, module.fdr_xml_to_json_function.name
, module.fdr_xml_to_json_function[0].name
)
severity = 3
frequency = 15
Expand All @@ -34,8 +34,8 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_xmltojson_appe

# AppException during conversion (Last retry)
resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_xmltojson_appexception_lastretry" {
count = var.env_short == "p" ? 1 : 0
name = "${module.fdr_xml_to_json_function.name}-app-exception-lastretry"
count = (var.enable_fdr3_features && var.env_short == "p") ? 1 : 0
name = "${module.fdr_xml_to_json_function[0].name}-app-exception-lastretry"
resource_group_name = data.azurerm_resource_group.fdr_rg.name
location = var.location

Expand All @@ -55,7 +55,7 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "alert_fdr_xmltojson_appe
| summarize Total=count() by length=bin(timestamp,1m)
| order by length desc
QUERY
, module.fdr_xml_to_json_function.name
, module.fdr_xml_to_json_function[0].name
)
severity = 1
frequency = 15
Expand Down
2 changes: 1 addition & 1 deletion src/domains/fdr-app/02_function.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module "reporting_fdr_function_snet" {
resource_group_name = data.azurerm_resource_group.rg_vnet.name
virtual_network_name = data.azurerm_virtual_network.vnet.name
private_endpoint_network_policies_enabled = var.private_endpoint_network_policies_enabled

service_endpoints = ["Microsoft.Storage"]
delegation = {
name = "default"
service_delegation = {
Expand Down
13 changes: 9 additions & 4 deletions src/domains/fdr-app/04_apim_fdr_fase3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ locals {
##################

resource "azurerm_api_management_api_version_set" "api_fdr_api_psp" {
count = var.enable_fdr3_features == true ? 1 : 0
name = "${var.env_short}-fdr-service-api-psp"
resource_group_name = local.pagopa_apim_rg
api_management_name = local.pagopa_apim_name
Expand All @@ -113,14 +114,15 @@ resource "azurerm_api_management_api_version_set" "api_fdr_api_psp" {


module "apim_api_fdr_api_v1_psp" {
count = var.enable_fdr3_features == true ? 1 : 0
source = "./.terraform/modules/__v3__/api_management_api"

name = "${local.project}-fdr-service-api-psp"
api_management_name = local.pagopa_apim_name
resource_group_name = local.pagopa_apim_rg
product_ids = [module.apim_fdr_product_psp.product_id]
subscription_required = local.apim_fdr_psp_service_api.subscription_required
version_set_id = azurerm_api_management_api_version_set.api_fdr_api_psp.id
version_set_id = azurerm_api_management_api_version_set.api_fdr_api_psp[0].id
api_version = "v1"

description = local.apim_fdr_psp_service_api.description
Expand All @@ -146,6 +148,7 @@ module "apim_api_fdr_api_v1_psp" {
##################

resource "azurerm_api_management_api_version_set" "api_fdr_api_org" {
count = var.enable_fdr3_features == true ? 1 : 0
name = "${var.env_short}-fdr-service-api-org"
resource_group_name = local.pagopa_apim_rg
api_management_name = local.pagopa_apim_name
Expand All @@ -155,14 +158,15 @@ resource "azurerm_api_management_api_version_set" "api_fdr_api_org" {


module "apim_api_fdr_api_v1_org" {
count = var.enable_fdr3_features == true ? 1 : 0
source = "./.terraform/modules/__v3__/api_management_api"

name = "${local.project}-fdr-service-api-org"
api_management_name = local.pagopa_apim_name
resource_group_name = local.pagopa_apim_rg
product_ids = [module.apim_fdr_product_org.product_id]
subscription_required = local.apim_fdr_org_service_api.subscription_required
version_set_id = azurerm_api_management_api_version_set.api_fdr_api_org.id
version_set_id = azurerm_api_management_api_version_set.api_fdr_api_org[0].id
api_version = "v1"

description = local.apim_fdr_org_service_api.description
Expand All @@ -187,7 +191,7 @@ module "apim_api_fdr_api_v1_org" {
## API FdR INTERNAL ##
#######################
resource "azurerm_api_management_api_version_set" "api_fdr_api_internal" {

count = var.enable_fdr3_features == true ? 1 : 0
name = "${var.env_short}-fdr-service-api-internal"
resource_group_name = local.pagopa_apim_rg
api_management_name = local.pagopa_apim_name
Expand All @@ -196,14 +200,15 @@ resource "azurerm_api_management_api_version_set" "api_fdr_api_internal" {
}

module "apim_api_fdr_api_v1_internal" {
count = var.enable_fdr3_features == true ? 1 : 0
source = "./.terraform/modules/__v3__/api_management_api"

name = "${local.project}-fdr-service-api-internal"
api_management_name = local.pagopa_apim_name
resource_group_name = local.pagopa_apim_rg
product_ids = [module.apim_fdr_product_internal.product_id]
subscription_required = local.apim_fdr_service_api_internal.subscription_required
version_set_id = azurerm_api_management_api_version_set.api_fdr_api_internal.id
version_set_id = azurerm_api_management_api_version_set.api_fdr_api_internal[0].id
api_version = "v1"

description = local.apim_fdr_service_api_internal.description
Expand Down
5 changes: 3 additions & 2 deletions src/domains/fdr-app/04_apim_fdr_json_to_xml.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ locals {
}

resource "azurerm_api_management_api_version_set" "api_fdr_json_to_xml_api" {

count = var.enable_fdr3_features == true ? 1 : 0
name = "${var.env_short}-fdr-json-to-xml-service-api"
resource_group_name = local.pagopa_apim_rg
api_management_name = local.pagopa_apim_name
Expand All @@ -44,14 +44,15 @@ resource "azurerm_api_management_api_version_set" "api_fdr_json_to_xml_api" {


module "apim_api_fdr_json_to_xml_api_v1" {
count = var.enable_fdr3_features == true ? 1 : 0
source = "./.terraform/modules/__v3__/api_management_api"

name = "${local.project}-fdr-json-to-xml-service-api"
api_management_name = local.pagopa_apim_name
resource_group_name = local.pagopa_apim_rg
product_ids = [module.apim_fdr_json_to_xml_product.product_id]
subscription_required = local.apim_fdr_json_to_xml_service_api.subscription_required
version_set_id = azurerm_api_management_api_version_set.api_fdr_json_to_xml_api.id
version_set_id = azurerm_api_management_api_version_set.api_fdr_json_to_xml_api[0].id
api_version = "v1"

description = local.apim_fdr_json_to_xml_service_api.description
Expand Down
Loading

0 comments on commit 7cb4bf7

Please sign in to comment.