Create a ServiceBus Namespace.

Example Usage

variable "location" {
  description = "Azure datacenter to deploy to."
  default = "West US"

variable "servicebus_name" {
  description = "Input your unique Azure service bus name"

resource "azurerm_resource_group" "test" {
  name     = "terraform-servicebus"
  location = "${var.location}"

resource "azurerm_servicebus_namespace" "test" {
  name                = "${var.servicebus_name}"
  location            = "${var.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  sku                 = "basic"

  tags {
    source = "terraform"

Argument Reference

The following arguments are supported:

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

  • resource_group_name - (Required) The name of the resource group in which to create the namespace.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • sku - (Required) Defines which tier to use. Options are basic, standard or premium.

  • capacity - (Optional) Specifies the capacity, can only be set when sku is Premium namespace. Can be 1, 2 or 4.

  • tags - (Optional) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The ServiceBus Namespace ID.

The following attributes are exported only if there is an authorization rule named RootManageSharedAccessKey which is created automatically by Azure.


Service Bus Namespace can be imported using the resource id, e.g.

terraform import azurerm_servicebus_namespace.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.servicebus/namespaces/sbns1

© 2018 HashiCorpLicensed under the MPL 2.0 License.