diff --git a/servicebus.tf b/servicebus.tf index 7f61065..8394aee 100644 --- a/servicebus.tf +++ b/servicebus.tf @@ -19,6 +19,13 @@ module "topic" { resource_group_name = azurerm_resource_group.rg.name } +module "topic_cpo" { + source = "git@github.com:hmcts/terraform-module-servicebus-topic" + name = "ccpay-cpo-Topic" + namespace_name = module.servicebus-namespace.name + resource_group_name = azurerm_resource_group.rg.name +} + module "queue" { source = "git@github.com:hmcts/terraform-module-servicebus-queue" name = local.retry_queue @@ -36,7 +43,15 @@ module "subscription" { forward_dead_lettered_messages_to = module.queue.name } - +module "subscription_cpo" { + source = "git@github.com:hmcts/terraform-module-servicebus-subscription" + name = local.subscription_name + namespace_name = module.servicebus-namespace.name + topic_name = module.topic_cpo.name + resource_group_name = azurerm_resource_group.rg.name + max_delivery_count = "1" + # forward_dead_lettered_messages_to = module.queue.name +} resource "azurerm_key_vault_secret" "servicebus_primary_connection_string" { name = "sb-primary-connection-string" @@ -44,15 +59,21 @@ resource "azurerm_key_vault_secret" "servicebus_primary_connection_string" { key_vault_id = data.azurerm_key_vault.ccpay_key_vault.id } -# primary connection string for send and listen operations -output "sb_primary_send_and_listen_connection_string" { - value = module.servicebus-namespace.primary_send_and_listen_connection_string +resource "azurerm_key_vault_secret" "cpo-topic-primary-send-listen-shared-access-key" { + name = "cpo-topic-primary-send-listen-shared-access-key" + value = module.topic_cpo.primary_send_and_listen_shared_access_key + key_vault_id = data.azurerm_key_vault.ccpay_key_vault.id } -output "topic_primary_send_and_listen_connection_string" { - value = module.topic.primary_send_and_listen_connection_string -} +# primary connection string for send and listen operations +# output "sb_primary_send_and_listen_connection_string" { +# value = module.servicebus-namespace.primary_send_and_listen_connection_string +# } -output "psc_subscription_connection_string" { - value = "${module.topic.primary_send_and_listen_connection_string}/subscriptions/${local.subscription_name}" -} +# output "topic_primary_send_and_listen_connection_string" { +# value = module.topic.primary_send_and_listen_connection_string +# } + +# output "psc_subscription_connection_string" { +# value = "${module.topic.primary_send_and_listen_connection_string}/subscriptions/${local.subscription_name}" +# }