Skip to content

azurermEventhubConsumerGroup

Manages a Event Hubs Consumer Group as a nested resource within an Event Hub.

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: "example-resources",
  }
);
const azurermEventhubNamespaceExample =
  new azurerm.eventhubNamespace.EventhubNamespace(this, "example_1", {
    capacity: 2,
    location: azurermResourceGroupExample.location,
    name: "acceptanceTestEventHubNamespace",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Basic",
    tags: {
      environment: "Production",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermEventhubNamespaceExample.overrideLogicalId("example");
const azurermEventhubExample = new azurerm.eventhub.Eventhub(
  this,
  "example_2",
  {
    message_retention: 2,
    name: "acceptanceTestEventHub",
    namespace_name: azurermEventhubNamespaceExample.name,
    partition_count: 2,
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermEventhubExample.overrideLogicalId("example");
const azurermEventhubConsumerGroupExample =
  new azurerm.eventhubConsumerGroup.EventhubConsumerGroup(this, "example_3", {
    eventhub_name: azurermEventhubExample.name,
    name: "acceptanceTestEventHubConsumerGroup",
    namespace_name: azurermEventhubNamespaceExample.name,
    resource_group_name: azurermResourceGroupExample.name,
    user_metadata: "some-meta-data",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermEventhubConsumerGroupExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the EventHub Consumer Group resource. Changing this forces a new resource to be created.

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

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

  • resourceGroupName - (Required) The name of the resource group in which the EventHub Consumer Group's grandparent Namespace exists. Changing this forces a new resource to be created.

  • userMetadata - (Optional) Specifies the user metadata.

Attributes Reference

The following attributes are exported:

  • id - The ID of the EventHub Consumer Group.

Timeouts

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

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

Import

EventHub Consumer Groups can be imported using the resourceId, e.g.

terraform import azurerm_eventhub_consumer_group.consumerGroup1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventHub/namespaces/namespace1/eventhubs/eventhub1/consumerGroups/consumerGroup1