diff --git a/main.tf b/main.tf index 708ac72..a5c259d 100644 --- a/main.tf +++ b/main.tf @@ -53,6 +53,22 @@ resource "azurerm_servicebus_namespace" "this" { tags = var.tags } +resource "azurerm_servicebus_queue" "this" { + for_each = var.queues + + name = each.value.name + namespace_id = azurerm_servicebus_namespace.this.id + partitioning_enabled = each.value.partitioning_enabled +} + +resource "azurerm_servicebus_topic" "this" { + for_each = var.topics + + name = each.value.name + namespace_id = azurerm_servicebus_namespace.this.id + partitioning_enabled = each.value.partitioning_enabled +} + resource "azurerm_monitor_diagnostic_setting" "this" { name = var.diagnostic_setting_name target_resource_id = azurerm_servicebus_namespace.this.id diff --git a/variables.tf b/variables.tf index 031caf7..2898950 100644 --- a/variables.tf +++ b/variables.tf @@ -101,6 +101,24 @@ variable "network_rule_set_trusted_services_allowed" { nullable = false } +variable "queues" { + description = "A map of queues to create for this Service Bus namespace." + type = map(object({ + name = string + partitioning_enabled = optional(bool, false) + })) + default = {} +} + +variable "topics" { + description = "A map of topics to create for this Service Bus namespace. Only applicable if value of SKU is \"Standard\" or \"Premium\"." + type = map(object({ + name = string + partitioning_enabled = optional(bool, false) + })) + default = {} +} + variable "log_analytics_workspace_id" { description = "The ID of the Log Analytics workspace to send diagnostics to." type = string