» azurerm_eventhub_namespace

Manages an EventHub Namespace.

» Example Usage

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_eventhub_namespace" "example" {
  name                = "example-namespace"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  sku                 = "Standard"
  capacity            = 2

  tags = {
    environment = "Production"
  }
}

» Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the EventHub 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. Changing this forces a new resource to be created.

  • 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. Valid options are Basic and Standard.

  • capacity - (Optional) Specifies the Capacity / Throughput Units for a Standard SKU namespace. Valid values range from 1 - 20.

  • auto_inflate_enabled - (Optional) Is Auto Inflate enabled for the EventHub Namespace?

  • dedicated_cluster_id - (Optional) Specifies the ID of the EventHub Dedicated Cluster where this Namespace should created. Changing this forces a new resource to be created.

  • identity - (Optional) An identity block as defined below.

  • maximum_throughput_units - (Optional) Specifies the maximum number of throughput units when Auto Inflate is Enabled. Valid values range from 1 - 20.

  • zone_redundant - (Optional) Specifies if the EventHub Namespace should be Zone Redundant (created across Availability Zones). Changing this forces a new resource to be created.

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

  • network_rulesets - (Optional) A network_rulesets block as defined below.


A identity block supports the following:

  • type - (Required) The Type of Identity which should be used for this EventHub Namespace. At this time the only possible value is SystemAssigned.

A network_rulesets block supports the following:

  • default_action - (Required) The default action to take when a rule is not matched. Possible values are Allow and Deny. Defaults to Deny.

  • virtual_network_rule - (Optional) One or more virtual_network_rule blocks as defined below.

  • ip_rule - (Optional) One or more ip_rule blocks as defined below.


A virtual_network_rule block supports the following:


A ip_rule block supports the following:

  • ip_mask - (Required) The ip mask to match on.

  • action - (Optional) The action to take when the rule is matched. Possible values are Allow.

» Attributes Reference

The following attributes are exported:

  • id - The EventHub Namespace ID.

  • identity - An identity block as documented below.

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


An identity block exports the following:

  • principal_id - The Client ID of the Service Principal assigned to this EventHub Namespace.

  • tenant_id - The ID of the Tenant the Service Principal is assigned in.

» Timeouts

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

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

» Import

EventHub Namespaces can be imported using the resource id, e.g.

terraform import azurerm_eventhub_namespace.namespace1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventHub/namespaces/namespace1