| subcategory | Messaging |
|---|---|
| layout | azurerm |
| page_title | Azure Resource Manager: azurerm_servicebus_namespace |
| description | Manages a ServiceBus Namespace. |
Manages a ServiceBus Namespace.
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "terraform-servicebus"
location = "West Europe"
}
resource "azurerm_servicebus_namespace" "example" {
name = "tfex-servicebus-namespace"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "Standard"
tags = {
source = "terraform"
}
}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 Changing this forces a new resource to be created. 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 areBasic,StandardorPremium. Please note that setting this field toPremiumwill force the creation of a new resource. -
identity- (Optional) Anidentityblock as defined below. -
capacity- (Optional) Specifies the capacity. WhenskuisPremium, capacity can be1,2,4,8or16. WhenskuisBasicorStandard, capacity can be0only. -
premium_messaging_partitions- (Optional) Specifies the number messaging partitions. Only valid whenskuisPremiumand the minimum number is1. Possible values include0,1,2, and4. Defaults to0for Standard, Basic namespace. Changing this forces a new resource to be created.
-> Note: It's not possible to change the partitioning option on any existing namespace. The number of partitions can only be set during namespace creation. Please check the doc https://learn.microsoft.com/en-us/azure/service-bus-messaging/enable-partitions-premium for more feature restrictions.
-
customer_managed_key- (Optional) Ancustomer_managed_keyblock as defined below. -
local_auth_enabled- (Optional) Whether or not SAS authentication is enabled for the Service Bus namespace. Defaults totrue. -
public_network_access_enabled- (Optional) Is public network access enabled for the Service Bus Namespace? Defaults totrue. -
minimum_tls_version- (Optional) The minimum supported TLS version for this Service Bus Namespace. Valid values are:1.0,1.1and1.2. Defaults to1.2. -
network_rule_set- (Optional) Annetwork_rule_setblock as defined below. -
tags- (Optional) A mapping of tags to assign to the resource.
An identity block supports the following:
-
type- (Required) Specifies the type of Managed Service Identity that should be configured on this ServiceBus Namespace. Possible values areSystemAssigned,UserAssigned,SystemAssigned, UserAssigned(to enable both). -
identity_ids- (Optional) Specifies a list of User Assigned Managed Identity IDs to be assigned to this ServiceBus namespace.
~> NOTE: This is required when type is set to UserAssigned or SystemAssigned, UserAssigned.
-> Note: Once customer-managed key encryption has been enabled, it cannot be disabled.
A customer_managed_key block supports the following:
-
key_vault_key_id- (Required) The ID of the Key Vault Key which should be used to Encrypt the data in this ServiceBus Namespace. -
identity_id- (Optional) The ID of the User Assigned Identity that has access to the key. -
infrastructure_encryption_enabled- (Optional) Used to specify whether enable Infrastructure Encryption (Double Encryption). Changing this forces a new resource to be created.
A network_rule_set block supports the following:
-
default_action- (Optional) Specifies the default action for the Network Rule Set. Possible values areAllowandDeny. Defaults toAllow. -
public_network_access_enabled- (Optional) Whether to allow traffic over public network. Possible values aretrueandfalse. Defaults totrue.
-> Note: To disable public network access, you must also configure the property public_network_access_enabled.
-
trusted_services_allowed- (Optional) Are Azure Services that are known and trusted for this resource type are allowed to bypass firewall configuration? See Trusted Microsoft Services -
ip_rules- (Optional) One or more IP Addresses, or CIDR Blocks which should be able to access the ServiceBus Namespace. -
network_rules- (Optional) One or morenetwork_rulesblocks as defined below.
A network_rules block supports the following:
-
subnet_id- (Required) The Subnet ID which should be able to access this ServiceBus Namespace. -
ignore_missing_vnet_service_endpoint- (Optional) Should the ServiceBus Namespace Network Rule Set ignore missing Virtual Network Service Endpoint option in the Subnet? Defaults tofalse.
In addition to the Arguments listed above - the following Attributes are exported:
-
id- The ServiceBus Namespace ID. -
identity- Anidentityblock as defined below, which contains the Managed Service Identity information for this ServiceBus Namespace. -
endpoint- The URL to access the ServiceBus Namespace.
A identity block exports the following:
-
principal_id- The Principal ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace. -
tenant_id- The Tenant ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace.
The following attributes are exported only if there is an authorization rule named RootManageSharedAccessKey which is created automatically by Azure.
-
default_primary_connection_string- The primary connection string for the authorization ruleRootManageSharedAccessKey. -
default_secondary_connection_string- The secondary connection string for the authorization ruleRootManageSharedAccessKey. -
default_primary_key- The primary access key for the authorization ruleRootManageSharedAccessKey. -
default_secondary_key- The secondary access key for the authorization ruleRootManageSharedAccessKey.
A identity block exports the following:
-
principal_id- The Principal ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace. -
tenant_id- The Tenant ID for the Service Principal associated with the Managed Service Identity of this ServiceBus Namespace.
The timeouts block allows you to specify timeouts for certain actions:
create- (Defaults to 30 minutes) Used when creating the ServiceBus Namespace.update- (Defaults to 30 minutes) Used when updating the ServiceBus Namespace.read- (Defaults to 5 minutes) Used when retrieving the ServiceBus Namespace.delete- (Defaults to 30 minutes) Used when deleting the ServiceBus Namespace.
Service Bus Namespace can be imported using the resource id, e.g.
terraform import azurerm_servicebus_namespace.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ServiceBus/namespaces/sbns1