diff --git a/src/domains/elt/_modules/function_apps/data.tf b/src/domains/elt/_modules/function_apps/data.tf index b235518db..9d0ec1a48 100644 --- a/src/domains/elt/_modules/function_apps/data.tf +++ b/src/domains/elt/_modules/function_apps/data.tf @@ -108,6 +108,37 @@ data "azurerm_eventhub_authorization_rule" "evh_ns_io_cosmos_profiles_fn" { resource_group_name = "${var.project}-evt-rg" } +// --------------------- +// A&I Event Hub Topic +// --------------------- + +data "azurerm_eventhub_authorization_rule" "evh_ns_service_preferences_send_auth_rule" { + name = "io-fn-elt" + namespace_name = "${var.project}-itn-auth-elt-evhns-01" + eventhub_name = "pdnd-io-cosmosdb-service-preferences" + resource_group_name = "${var.project}-itn-auth-elt-rg-01" +} + +data "azurerm_eventhub_authorization_rule" "evh_ns_profiles_send_auth_rule" { + name = "io-fn-elt" + namespace_name = "${var.project}-itn-auth-elt-evhns-01" + eventhub_name = "pdnd-io-cosmosdb-profiles" + resource_group_name = "${var.project}-itn-auth-elt-rg-01" +} + + +data "azurerm_eventhub_authorization_rule" "evh_ns_profile_deletion_send_auth_rule" { + name = "io-fn-elt" + namespace_name = "${var.project}-itn-auth-elt-evhns-01" + eventhub_name = "pdnd-io-cosmosdb-profile-deletion" + resource_group_name = "${var.project}-itn-auth-elt-rg-01" +} + +// --------------------- +// /end A&I Event Hub Topic +// --------------------- + + data "azurerm_key_vault" "kv_common" { name = "${var.project}-kv-common" resource_group_name = local.resource_group_name_common diff --git a/src/domains/elt/_modules/function_apps/function_app_elt.tf b/src/domains/elt/_modules/function_apps/function_app_elt.tf index b7f4ca160..cea738cd2 100644 --- a/src/domains/elt/_modules/function_apps/function_app_elt.tf +++ b/src/domains/elt/_modules/function_apps/function_app_elt.tf @@ -45,13 +45,30 @@ locals { NOTIFICATION_STATUS_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_pdnd_io_cosmos_notification_status_fn.primary_connection_string NOTIFICATION_STATUS_LEASES_PREFIX = "notification-status-001" + // A&I Event Hub + TARGETKAFKAAUTH_clientId = "IO_FUNCTIONS_ELT" + TARGETKAFKAAUTH_brokers = local.auth_event_hub_connection + TARGETKAFKAAUTH_ssl = "true" + TARGETKAFKAAUTH_maxInFlightRequests = "1" + TARGETKAFKAAUTH_idempotent = "true" + TARGETKAFKAAUTH_transactionalId = "IO_ELT" + TARGETKAFKAAUTH_sasl_mechanism = "plain" + TARGETKAFKAAUTH_sasl_username = "$ConnectionString" + TARGETKAFKAAUTH_sasl_password = data.azurerm_eventhub_authorization_rule.evh_ns_service_preferences_send_auth_rule.primary_connection_string + TARGETKAFKAAUTH_topic = "pdnd-io-cosmosdb-service-preferences" + SERVICE_PREFERENCES_TOPIC_NAME = "pdnd-io-cosmosdb-service-preferences" - SERVICE_PREFERENCES_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_pdnd_io_cosmos_service_preferences_fn.primary_connection_string - SERVICE_PREFERENCES_LEASES_PREFIX = "service-preferences-001" + SERVICE_PREFERENCES_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_service_preferences_send_auth_rule.primary_connection_string + SERVICE_PREFERENCES_LEASES_PREFIX = "service-preferences-003" PROFILES_TOPIC_NAME = "pdnd-io-cosmosdb-profiles" - PROFILES_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_pdnd_io_cosmos_profiles_fn.primary_connection_string - PROFILES_LEASES_PREFIX = "profiles-001" + PROFILES_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_profiles_send_auth_rule.primary_connection_string + PROFILES_LEASES_PREFIX = "profiles-003" + + PROFILE_DELETION_TOPIC_NAME = "pdnd-io-cosmosdb-profile-deletion" + PROFILE_DELETION_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_profile_deletion_send_auth_rule.primary_connection_string + PROFILE_DELETION_LEASES_PREFIX = "profile-deletion-001" + ERROR_STORAGE_ACCOUNT = var.storage_account_name ERROR_STORAGE_KEY = var.storage_account_primary_access_key @@ -97,6 +114,7 @@ locals { SERVICES_FAILURE_QUEUE_NAME = "pdnd-io-cosmosdb-services-failure" SERVICE_PREFERENCES_FAILURE_QUEUE_NAME = local.service_preferences_failure_queue_name PROFILES_FAILURE_QUEUE_NAME = local.profiles_failure_queue_name + PROFILE_DELETION_FAILURE_QUEUE_NAME = local.profile_deletion_failure_queue_name # PDV integration env variables PDV_TOKENIZER_API_KEY = data.azurerm_key_vault_secret.pdv_tokenizer_api_key.value, @@ -153,6 +171,7 @@ module "function_elt" { "AzureWebJobs.AnalyticsServiceStorageQueueInboundProcessorAdapter.Disabled" = "0" "AzureWebJobs.AnalyticsServicePreferencesChangeFeedInboundProcessorAdapter.Disabled" = "1" "AzureWebJobs.AnalyticsProfilesChangeFeedInboundProcessorAdapter.Disabled" = "1" + "AzureWebJobs.AnalyticsDeletesChangeFeedInboundProcessorAdapter.Disabled" = "1" } ) @@ -181,7 +200,9 @@ module "function_elt" { local.service_preferences_failure_queue_name, "${local.service_preferences_failure_queue_name}-poison", local.profiles_failure_queue_name, - "${local.profiles_failure_queue_name}-poison" + "${local.profiles_failure_queue_name}-poison", + local.profile_deletion_failure_queue_name, + "${local.profile_deletion_failure_queue_name}-poison" ], "containers" = [], "blobs_retention_days" = 1, diff --git a/src/domains/elt/_modules/function_apps/locals.tf b/src/domains/elt/_modules/function_apps/locals.tf index cb209ae22..a820be9e2 100644 --- a/src/domains/elt/_modules/function_apps/locals.tf +++ b/src/domains/elt/_modules/function_apps/locals.tf @@ -12,10 +12,12 @@ locals { "51.144.56.176/28", ] - event_hub_connection = "${format("%s-evh-ns", var.project)}.servicebus.windows.net:9093" + event_hub_connection = "${format("%s-evh-ns", var.project)}.servicebus.windows.net:9093" + auth_event_hub_connection = "${format("%s-itn-auth-elt-evhns-01", var.project)}.servicebus.windows.net:9093" pn_service_id = "01G40DWQGKY5GRWSNM4303VNRP" service_preferences_failure_queue_name = "pdnd-io-cosmosdb-service-preferences-failure" profiles_failure_queue_name = "pdnd-io-cosmosdb-profiles-failure" + profile_deletion_failure_queue_name = "pdnd-io-cosmosdb-profile-deletion-failure" }