Manages an IotHub ServiceBus Topic Endpoint
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_servicebus_namespace" "example" {
name = "exampleNamespace"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "Standard"
}
resource "azurerm_servicebus_topic" "example" {
name = "exampleTopic"
namespace_id = azurerm_servicebus_namespace.example.id
}
resource "azurerm_servicebus_topic_authorization_rule" "example" {
name = "exampleRule"
topic_id = azurerm_servicebus_topic.example.id
listen = false
send = true
manage = false
}
resource "azurerm_iothub" "example" {
name = "exampleIothub"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku {
name = "B1"
capacity = "1"
}
tags = {
purpose = "example"
}
}
resource "azurerm_iothub_endpoint_servicebus_topic" "example" {
resource_group_name = azurerm_resource_group.example.name
iothub_id = azurerm_iothub.example.id
name = "example"
connection_string = azurerm_servicebus_topic_authorization_rule.example.primary_connection_string
}
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.
resource_group_name
- (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.
authentication_type
- (Optional) Type used to authenticate against the Service Bus Topic endpoint. Possible values are keyBased
and identityBased
. Defaults to keyBased
.
identity_id
- (Optional) ID of the User Managed Identity used to authenticate against the Service Bus Topic endpoint.
endpoint_uri
- (Optional) URI of the Service Bus endpoint. This attribute can only be specified and is mandatory when authentication_type
is identityBased
.
entity_path
- (Optional) Name of the Service Bus Topic. This attribute can only be specified and is mandatory when authentication_type
is identityBased
.
connection_string
- (Optional) The connection string for the endpoint. This attribute can only be specified and is mandatory when authentication_type
is keyBased
.
iothub_id
- (Required) The IoTHub ID for the endpoint. Changing this forces a new resource to be created.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the IoTHub ServiceBus Topic Endpoint.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.IoTHub ServiceBus Topic Endpoint can be imported using the resource id
, 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