Skip to content

azurermServicebusQueueAuthorizationRule

Manages an Authorization Rule for a ServiceBus Queue.

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: "terraform-servicebus",
  }
);
const azurermServicebusNamespaceExample =
  new azurerm.servicebusNamespace.ServicebusNamespace(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "tfex-servicebus-namespace",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
    tags: {
      source: "terraform",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusNamespaceExample.overrideLogicalId("example");
const azurermServicebusQueueExample =
  new azurerm.servicebusQueue.ServicebusQueue(this, "example_2", {
    enable_partitioning: true,
    name: "tfex_servicebus_queue",
    namespace_id: azurermServicebusNamespaceExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusQueueExample.overrideLogicalId("example");
const azurermServicebusQueueAuthorizationRuleExample =
  new azurerm.servicebusQueueAuthorizationRule.ServicebusQueueAuthorizationRule(
    this,
    "example_3",
    {
      listen: true,
      manage: false,
      name: "examplerule",
      queue_id: azurermServicebusQueueExample.id,
      send: true,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusQueueAuthorizationRuleExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

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

  • queueId - (Required) Specifies the ID of the ServiceBus Queue. 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 Listen permissions to the ServiceBus Queue? Defaults to false.

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

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

Attributes Reference

The following attributes are exported:

  • id - The ID of the Authorization Rule.

  • primaryKey - The Primary Key for the Authorization Rule.

  • primaryConnectionString - The Primary Connection String for the Authorization Rule.

  • secondaryKey - The Secondary Key for the Authorization Rule.

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

  • primaryConnectionStringAlias - The alias Primary Connection String for the ServiceBus Namespace, if the namespace is Geo DR paired.

  • secondaryConnectionStringAlias - The alias Secondary Connection String for the ServiceBus Namespace

Timeouts

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

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

Import

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

terraform import azurerm_servicebus_queue_authorization_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceBus/namespaces/namespace1/queues/queue1/authorizationRules/rule1