Skip to content

azurermServicebusNamespaceDisasterRecoveryConfig

Manages a Disaster Recovery Config for a Service Bus Namespace.

\~> NOTE: Disaster Recovery Config is a Premium SKU only capability.

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: "servicebus-replication",
  }
);
const azurermServicebusNamespacePrimary =
  new azurerm.servicebusNamespace.ServicebusNamespace(this, "primary", {
    capacity: "1",
    location: azurermResourceGroupExample.location,
    name: "servicebus-primary",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Premium",
  });
const azurermServicebusNamespaceSecondary =
  new azurerm.servicebusNamespace.ServicebusNamespace(this, "secondary", {
    capacity: "1",
    location: azurermResourceGroupExample.location,
    name: "servicebus-secondary",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Premium",
  });
const azurermServicebusNamespaceAuthorizationRuleExample =
  new azurerm.servicebusNamespaceAuthorizationRule.ServicebusNamespaceAuthorizationRule(
    this,
    "example_3",
    {
      listen: true,
      manage: false,
      name: "examplerule",
      namespace_id: "${azurerm_servicebus_namespace.example.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.*/
azurermServicebusNamespaceAuthorizationRuleExample.overrideLogicalId("example");
const azurermServicebusNamespaceDisasterRecoveryConfigExample =
  new azurerm.servicebusNamespaceDisasterRecoveryConfig.ServicebusNamespaceDisasterRecoveryConfig(
    this,
    "example_4",
    {
      alias_authorization_rule_id:
        azurermServicebusNamespaceAuthorizationRuleExample.id,
      name: "servicebus-alias-name",
      partner_namespace_id: azurermServicebusNamespaceSecondary.id,
      primary_namespace_id: azurermServicebusNamespacePrimary.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.*/
azurermServicebusNamespaceDisasterRecoveryConfigExample.overrideLogicalId(
  "example"
);

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.

  • primaryNamespaceId - (Required) The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.

  • partnerNamespaceId - (Required) The ID of the Service Bus Namespace to replicate to.

  • aliasAuthorizationRuleId - (Optional) The Shared access policies used to access the connection string for the alias.

Attributes Reference

The following attributes are exported:

  • id - The Service Bus Namespace Disaster Recovery Config ID.

  • primaryConnectionStringAlias - The alias Primary Connection String for the ServiceBus Namespace.

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

  • defaultPrimaryKey - The primary access key for the authorization rule rootManageSharedAccessKey.

  • defaultSecondaryKey - The secondary access key for the authorization rule rootManageSharedAccessKey.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Service Bus Namespace Disaster Recovery Config.
  • update - (Defaults to 30 minutes) Used when updating the Service Bus Namespace Disaster Recovery Config.
  • read - (Defaults to 5 minutes) Used when retrieving the Service Bus Namespace Disaster Recovery Config.
  • delete - (Defaults to 30 minutes) Used when deleting the Service Bus Namespace Disaster Recovery Config.

Import

Service Bus DR configs can be imported using the resourceId, e.g.

terraform import azurerm_servicebus_namespace_disaster_recovery_config.config1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceBus/namespaces/namespace1/disasterRecoveryConfigs/config1