Skip to content

azurermIothubEndpointServicebusTopic

Manages an IotHub ServiceBus Topic Endpoint

\~> NOTE: Endpoints can be defined either directly on the azurermIothub resource, or using the azurermIothubEndpoint_* resources - but the two ways of defining the endpoints cannot be used together. If both are used against the same IoTHub, spurious changes will occur. Also, defining a azurermIothubEndpoint_* resource and another endpoint of a different type directly on the azurermIothub resource is not supported.

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 azurermServicebusNamespaceExample =
  new azurerm.servicebusNamespace.ServicebusNamespace(this, "example_1", {
    location: azurermResourceGroupExample.location,
    name: "exampleNamespace",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  });
/*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 azurermServicebusTopicExample =
  new azurerm.servicebusTopic.ServicebusTopic(this, "example_2", {
    name: "exampleTopic",
    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.*/
azurermServicebusTopicExample.overrideLogicalId("example");
const azurermServicebusTopicAuthorizationRuleExample =
  new azurerm.servicebusTopicAuthorizationRule.ServicebusTopicAuthorizationRule(
    this,
    "example_3",
    {
      listen: false,
      manage: false,
      name: "exampleRule",
      send: true,
      topic_id: azurermServicebusTopicExample.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.*/
azurermServicebusTopicAuthorizationRuleExample.overrideLogicalId("example");
const azurermIothubExample = new azurerm.iothub.Iothub(this, "example_4", {
  location: azurermResourceGroupExample.location,
  name: "exampleIothub",
  resource_group_name: azurermResourceGroupExample.name,
  sku: [
    {
      capacity: "1",
      name: "B1",
    },
  ],
  tags: {
    purpose: "example",
  },
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermIothubExample.overrideLogicalId("example");
const azurermIothubEndpointServicebusTopicExample =
  new azurerm.iothubEndpointServicebusTopic.IothubEndpointServicebusTopic(
    this,
    "example_5",
    {
      connection_string:
        azurermServicebusTopicAuthorizationRuleExample.primaryConnectionString,
      iothub_id: azurermIothubExample.id,
      name: "example",
      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.*/
azurermIothubEndpointServicebusTopicExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the endpoint. The name must be unique across endpoint types. The following names are reserved: events, operationsMonitoringEvents, fileNotifications and $default. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group under which the Service Bus Topic has been created. Changing this forces a new resource to be created.

  • authenticationType - (Optional) Type used to authenticate against the Service Bus Topic endpoint. Possible values are keyBased and identityBased. Defaults to keyBased.

  • identityId - (Optional) ID of the User Managed Identity used to authenticate against the Service Bus Topic endpoint.

-> NOTE: identityId can only be specified when authenticationType is identityBased. It must be one of the identityIds of the Iot Hub. If not specified when authenticationType is identityBased, System Assigned Managed Identity of the Iot Hub will be used.

  • endpointUri - (Optional) URI of the Service Bus endpoint. This attribute can only be specified and is mandatory when authenticationType is identityBased.

  • entityPath - (Optional) Name of the Service Bus Topic. This attribute can only be specified and is mandatory when authenticationType is identityBased.

  • connectionString - (Optional) The connection string for the endpoint. This attribute can only be specified and is mandatory when authenticationType is keyBased.

  • iothubId - (Required) The IoTHub ID for the endpoint. Changing this forces a new resource to be created.

Attributes Reference

The following attributes are exported:

  • id - The ID of the IoTHub ServiceBus Topic Endpoint.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the IotHub ServiceBus Topic Endpoint.
  • update - (Defaults to 30 minutes) Used when updating the IotHub ServiceBus Topic Endpoint.
  • read - (Defaults to 5 minutes) Used when retrieving the IotHub ServiceBus Topic Endpoint.
  • delete - (Defaults to 30 minutes) Used when deleting the IotHub ServiceBus Topic Endpoint.

Import

IoTHub ServiceBus Topic Endpoint can be imported using the resourceId, e.g.

terraform import azurerm_iothub_endpoint_servicebus_topic.servicebus_topic1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/endpoints/servicebustopic_endpoint1