Skip to content

azurermServicebusTopic

Manages a ServiceBus Topic.

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

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "tfex-servicebus-topic",
  }
);
const azurermServicebusNamespaceExample =
  new azurerm.servicebusNamespace.ServicebusNamespace(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "tfex-servicebus-namespace",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
    tags: {
      source: "terraform",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusNamespaceExample.overrideLogicalId("example");
const azurermServicebusTopicExample =
  new azurerm.servicebusTopic.ServicebusTopic(this, "example_2", {
    enable_partitioning: true,
    name: "tfex_servicebus_topic",
    namespace_id: azurermServicebusNamespaceExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusTopicExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the ServiceBus Topic resource. Changing this forces a new resource to be created.

  • namespaceId - (Required) The ID of the ServiceBus Namespace to create Changing this forces a new resource to be created. this topic in. Changing this forces a new resource to be created.

  • status - (Optional) The Status of the Service Bus Topic. Acceptable values are active or disabled. Defaults to active.

  • autoDeleteOnIdle - (Optional) The ISO 8601 timespan duration of the idle interval after which the Topic is automatically deleted, minimum of 5 minutes.

  • defaultMessageTtl - (Optional) The ISO 8601 timespan duration of TTL of messages sent to this topic if no TTL value is set on the message itself.

  • duplicateDetectionHistoryTimeWindow - (Optional) The ISO 8601 timespan duration during which duplicates can be detected. Defaults to 10 minutes. (pt10M)

  • enableBatchedOperations - (Optional) Boolean flag which controls if server-side batched operations are enabled.

  • enableExpress - (Optional) Boolean flag which controls whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage.

  • enablePartitioning - (Optional) Boolean flag which controls whether to enable Changing this forces a new resource to be created. the topic to be partitioned across multiple message brokers. Defaults to false. Changing this forces a new resource to be created.

-> NOTE: Partitioning is available at entity creation for all queues and topics in Basic or Standard SKUs. It is not available for the Premium messaging SKU, but any previously existing partitioned entities in Premium namespaces continue to work as expected. Please see the documentation for more information.

  • maxMessageSizeInKilobytes - (Optional) Integer value which controls the maximum size of a message allowed on the topic for Premium SKU. For supported values see the "Large messages support" section of this document.

  • maxSizeInMegabytes - (Optional) Integer value which controls the size of memory allocated for the topic. For supported values see the "Queue/topic size" section of this document.

  • requiresDuplicateDetection - (Optional) Boolean flag which controls whether Changing this forces a new resource to be created. the Topic requires duplicate detection. Defaults to false. Changing this forces a new resource to be created.

  • supportOrdering - (Optional) Boolean flag which controls whether the Topic supports ordering.

Attributes Reference

The following attributes are exported:

  • id - The ServiceBus Topic ID.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the ServiceBus Topic.
  • update - (Defaults to 30 minutes) Used when updating the ServiceBus Topic.
  • read - (Defaults to 5 minutes) Used when retrieving the ServiceBus Topic.
  • delete - (Defaults to 30 minutes) Used when deleting the ServiceBus Topic.

Import

Service Bus Topics can be imported using the resourceId, e.g.

terraform import azurerm_servicebus_topic.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ServiceBus/namespaces/sbns1/topics/sntopic1