Azure Messaging Topic

This page shows how to write Terraform for Messaging Topic and write them securely.

azurerm_servicebus_topic (Terraform)

The Topic in Messaging can be configured in Terraform with the resource name azurerm_servicebus_topic. The following sections describe 6 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L38
resource "azurerm_servicebus_topic" "testrbtopic1" {
  name                = var.sbTopicName1
  resource_group_name = azurerm_resource_group.rgtestsb.name
  namespace_name      = azurerm_servicebus_namespace.testsbname.name
  enable_partitioning = var.enable_partitioning_topic1
}
servicebus.tf#L34
resource "azurerm_servicebus_topic" "sb_topic_hr" {
  name                = ""
  resource_group_name = var.resource_group_name
  namespace_name      = azurerm_servicebus_namespace.sb.name
  depends_on          = [azurerm_kubernetes_cluster.k8s]
  enable_partitioning = false
main.tf#L1
resource "azurerm_servicebus_topic" "topic" {
  name                = var.name
  resource_group_name = var.resource_group_name
  namespace_name      = var.azure_bus_namespace
  enable_partitioning = var.enable_partitioning
}
main.tf#L16
resource "azurerm_servicebus_topic" "topic" {
  for_each = toset(local.topics)
  # count = length(local.topics)

  name                = each.value.name #local.topics[count.index].name
  resource_group_name = var.resource_group_name
topics.tf#L1
resource "azurerm_servicebus_topic" "properties-created" {
  name                = "propt.properties.propterycreated.v1"
  resource_group_name = var.servicebus_name
  namespace_name      = var.servicebus_rg

  enable_partitioning = true
servicebus.tf#L18
resource "azurerm_servicebus_topic" "sb_topic_name" {
  name                = random_string.sb_topic.result
  resource_group_name = azurerm_resource_group.rg.name
  namespace_name      = azurerm_servicebus_namespace.sb_namespace.name

  enable_partitioning = true

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a ServiceBus Topic. Note Topics can only be created in Namespaces with an SKU of standard or higher.

Azure Resource Manager Example

Azure Resource Manager code does not have the related resource.

Frequently asked questions

What is Azure Messaging Topic?

Azure Messaging Topic is a resource for Messaging of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Messaging Topic?

For Terraform, the iac-coder/modularteracodestructure, mnhat3896/Automated-Provisioning and atticalabs/terraform source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.