Azure Messaging Eventhub

This page shows how to write Terraform and Azure Resource Manager for Messaging Eventhub and write them securely.

azurerm_eventhub (Terraform)

The Eventhub in Messaging can be configured in Terraform with the resource name azurerm_eventhub. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L22
resource "azurerm_eventhub" "providertesttpk1" {
  name                = "providerTestTopic1"
  namespace_name      = azurerm_eventhub_namespace.mqkconnector.name
  resource_group_name = azurerm_resource_group.mqktest.name
  partition_count     = 5
  message_retention   = 7
main.tf#L27
resource "azurerm_eventhub" "input" {
  name                = "input"
  namespace_name      = azurerm_eventhub_namespace.event_ns.name
  resource_group_name = local.resource_group_name
  partition_count     = 32
  message_retention   = 3 # day(s)
event_hubs.tf#L9
resource "azurerm_eventhub" "example" {
  name                = var.event_hubs_name
  namespace_name      = azurerm_eventhub_namespace.example.name
  resource_group_name = azurerm_resource_group.policy-rg.name
  partition_count     = 2
  message_retention   = 1
main.tf#L7
resource "azurerm_eventhub" "example" {
  name                = var.name
  namespace_name      = var.namespace_name
  resource_group_name = var.resource_group_name
  partition_count     = 2
  message_retention   = 1
resource.tf#L2
resource "azurerm_eventhub" "eh" {
  name                = var.res_eh_name
  namespace_name      = var.res_eh_ns_name
  resource_group_name = var.res_eh_rg_name
  partition_count     = var.res_eh_patition_count
  message_retention   = var.res_eh_msg_retention
eventhub.tf#L10
resource "azurerm_eventhub" "evh" {
  name                = var.name-evh
  resource_group_name = azurerm_resource_group.rg.name
  namespace_name      = azurerm_eventhub_namespace.evhns.name
  partition_count     = var.partition-count-evh
  message_retention   = var.message-retention-evh
eventhub.tf#L10
resource "azurerm_eventhub" "evh" {
  name                = var.name-evh
  resource_group_name = azurerm_resource_group.rg.name
  namespace_name      = azurerm_eventhub_namespace.evhns.name
  partition_count     = var.partition-count-evh
  message_retention   = var.message-retention-evh
eventhubs.tf#L13
resource "azurerm_eventhub" "hubs" {
  name                = "porterform-eventhub"
  namespace_name      = azurerm_eventhub_namespace.hubs.name
  resource_group_name = azurerm_resource_group.rg.name
  partition_count     = 2
  message_retention   = 1
main.tf#L16
resource "azurerm_eventhub" "example" {
  name                = var.eventhub_name
  namespace_name      = azurerm_eventhub_namespace.example.name
  resource_group_name = azurerm_resource_group.example.name
  partition_count     = 2
  message_retention   = 1
event_hub.tf#L10
resource "azurerm_eventhub" "evhubiot" {
  name                = var.event_hub_name
  resource_group_name = azurerm_resource_group.rg.name
  namespace_name      = azurerm_eventhub_namespace.evhubiotnmspace.name
  partition_count     = 2
  message_retention   = 1

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 Event Hubs as a nested resource within a Event Hubs namespace.

Microsoft.EventHub/namespaces/eventhubs (Azure Resource Manager)

The namespaces/eventhubs in Microsoft.EventHub can be configured in Azure Resource Manager with the resource name Microsoft.EventHub/namespaces/eventhubs. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

  • apiVersion required - string
  • name required - string

    The Event Hub name

  • properties required
      • captureDescription optional
          • destination optional
              • name optional - string

                Name for capture destination

              • properties optional
                  • archiveNameFormat optional - string

                    Blob naming convention for archive, e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}. Here all the parameters (Namespace,EventHub .. etc) are mandatory irrespective of order

                  • blobContainer optional - string

                    Blob container Name

                  • dataLakeAccountName optional - string

                    The Azure Data Lake Store name for the captured events

                  • dataLakeFolderPath optional - string

                    The destination folder path for the captured events

                  • dataLakeSubscriptionId optional - string

                    Subscription Id of Azure Data Lake Store

                  • storageAccountResourceId optional - string

                    Resource id of the storage account to be used to create the blobs

          • enabled optional - boolean

            A value that indicates whether capture description is enabled.

          • encoding optional - string

            Enumerates the possible values for the encoding format of capture description. Note: 'AvroDeflate' will be deprecated in New API Version.

          • intervalInSeconds optional - integer

            The time window allows you to set the frequency with which the capture to Azure Blobs will happen, value should between 60 to 900 seconds

          • sizeLimitInBytes optional - integer

            The size window defines the amount of data built up in your Event Hub before an capture operation, value should be between 10485760 to 524288000 bytes

          • skipEmptyArchives optional - boolean

            A value that indicates whether to Skip Empty Archives

      • messageRetentionInDays optional - integer

        Number of days to retain the events for this Event Hub, value should be 1 to 7 days

      • partitionCount optional - integer

        Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions.

      • status optional - string

        Enumerates the possible values for the status of the Event Hub.

  • type required - string

Frequently asked questions

What is Azure Messaging Eventhub?

Azure Messaging Eventhub 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 Eventhub?

For Terraform, the rajuraghavan69/spring-boot-petclinic, marvin-heiden/sendungsverfolgung and timwebster9/azure-policy-logging source code examples are useful. See the Terraform Example section for further details.