Skip to content

azurermEventhubAuthorizationRule

Manages a Event Hubs authorization Rule 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 azurermEventhubAuthorizationRuleExample =
  new azurerm.eventhubAuthorizationRule.EventhubAuthorizationRule(
    this,
    "example_3",
    {
      eventhub_name: azurermEventhubExample.name,
      listen: true,
      manage: false,
      name: "navi",
      namespace_name: azurermEventhubNamespaceExample.name,
      resource_group_name: azurermResourceGroupExample.name,
      send: false,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermEventhubAuthorizationRuleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

\~> NOTE At least one of the 3 permissions below needs to be set.

  • listen - (Optional) Does this Authorization Rule have permissions to Listen to the Event Hub? Defaults to false.

  • send - (Optional) Does this Authorization Rule have permissions to Send to the Event Hub? Defaults to false.

  • manage - (Optional) Does this Authorization Rule have permissions to Manage to the Event Hub? When this property is true - both listen and send must be too. Defaults to false.

Attributes Reference

The following attributes are exported:

  • id - The EventHub ID.

  • primaryConnectionStringAlias - The alias of the Primary Connection String for the Event Hubs authorization Rule, which is generated when disaster recovery is enabled.

  • secondaryConnectionStringAlias - The alias of the Secondary Connection String for the Event Hubs Authorization Rule, which is generated when disaster recovery is enabled.

  • primaryConnectionString - The Primary Connection String for the Event Hubs authorization Rule.

  • primaryKey - The Primary Key for the Event Hubs authorization Rule.

  • secondaryConnectionString - The Secondary Connection String for the Event Hubs Authorization Rule.

  • secondaryKey - The Secondary Key for the Event Hubs Authorization Rule.

Timeouts

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

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

Import

EventHub Authorization Rules can be imported using the resourceId, e.g.

terraform import azurerm_eventhub_authorization_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventHub/namespaces/namespace1/eventhubs/eventhub1/authorizationRules/rule1