Skip to content

Commit

Permalink
[#IOPID-2413, #IOPID-2415, #IOPID-2346] Move A&I export to domain EH (#…
Browse files Browse the repository at this point in the history
…1248)

Co-authored-by: Daniele Manni <[email protected]>
  • Loading branch information
gquadrati and BurnedMarshal authored Oct 24, 2024
1 parent 2f86a3e commit f5495f6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
31 changes: 31 additions & 0 deletions src/domains/elt/_modules/function_apps/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "${var.project}-itn-auth-elt-service-preferences-01"
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 = "${var.project}-itn-auth-elt-profiles-01"
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 = "${var.project}-itn-auth-elt-profile-deletion-01"
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
Expand Down
34 changes: 26 additions & 8 deletions src/domains/elt/_modules/function_apps/function_app_elt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,27 @@ 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"

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"
// 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_topic = "dummy" #Needed by KafkaProducerTopicConfig decoder

SERVICE_PREFERENCES_TOPIC_NAME = data.azurerm_eventhub_authorization_rule.evh_ns_service_preferences_send_auth_rule.eventhub_name
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 = data.azurerm_eventhub_authorization_rule.evh_ns_profiles_send_auth_rule.eventhub_name
PROFILES_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_profiles_send_auth_rule.primary_connection_string
PROFILES_LEASES_PREFIX = "profiles-003"

DELETES_TOPIC_NAME = data.azurerm_eventhub_authorization_rule.evh_ns_profile_deletion_send_auth_rule.eventhub_name
DELETES_TOPIC_CONNECTION_STRING = data.azurerm_eventhub_authorization_rule.evh_ns_profile_deletion_send_auth_rule.primary_connection_string
DELETES_LEASES_PREFIX = "profile-deletion-001"

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"

ERROR_STORAGE_ACCOUNT = var.storage_account_name
ERROR_STORAGE_KEY = var.storage_account_primary_access_key
Expand Down Expand Up @@ -97,6 +111,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
DELETES_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,
Expand Down Expand Up @@ -134,7 +149,7 @@ module "function_elt" {
app_service_plan_info = {
kind = "elastic"
sku_tier = "ElasticPremium"
sku_size = "EP1"
sku_size = "EP2"
maximum_elastic_worker_count = 1
worker_count = null
zone_balancing_enabled = null
Expand All @@ -153,6 +168,7 @@ module "function_elt" {
"AzureWebJobs.AnalyticsServiceStorageQueueInboundProcessorAdapter.Disabled" = "0"
"AzureWebJobs.AnalyticsServicePreferencesChangeFeedInboundProcessorAdapter.Disabled" = "1"
"AzureWebJobs.AnalyticsProfilesChangeFeedInboundProcessorAdapter.Disabled" = "1"
"AzureWebJobs.AnalyticsUserDataProcessingChangeFeedInboundProcessorAdapter.Disabled" = "1"
}
)

Expand Down Expand Up @@ -181,7 +197,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,
Expand Down
4 changes: 3 additions & 1 deletion src/domains/elt/_modules/function_apps/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit f5495f6

Please sign in to comment.