Manages an IotHub EventHub Endpoint
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_eventhub_namespace" "example" {
name = "exampleEventHubNamespace"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "Basic"
}
resource "azurerm_eventhub" "example" {
name = "exampleEventHub"
namespace_name = azurerm_eventhub_namespace.example.name
resource_group_name = azurerm_resource_group.example.name
partition_count = 2
message_retention = 1
}
resource "azurerm_eventhub_authorization_rule" "example" {
name = "exampleRule"
namespace_name = azurerm_eventhub_namespace.example.name
eventhub_name = azurerm_eventhub.example.name
resource_group_name = azurerm_resource_group.example.name
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_eventhub" "example" {
resource_group_name = azurerm_resource_group.example.name
iothub_id = azurerm_iothub.example.id
name = "example"
connection_string = azurerm_eventhub_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 Event Hub has been created. Changing this forces a new resource to be created.
authentication_type
- (Optional) Type used to authenticate against the Event Hub endpoint. Possible values are keyBased
and identityBased
. Defaults to keyBased
.
identity_id
- (Optional) ID of the User Managed Identity used to authenticate against the Event Hub endpoint.
endpoint_uri
- (Optional) URI of the Event Hubs Namespace endpoint. This attribute can only be specified and is mandatory when authentication_type
is identityBased
.
entity_path
- (Optional) Name of the Event Hub. 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 EventHub Endpoint.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the IotHub EventHub Endpoint.update
- (Defaults to 30 minutes) Used when updating the IotHub EventHub Endpoint.read
- (Defaults to 5 minutes) Used when retrieving the IotHub EventHub Endpoint.delete
- (Defaults to 30 minutes) Used when deleting the IotHub EventHub Endpoint.IoTHub EventHub Endpoint can be imported using the resource id
, e.g.
terraform import azurerm_iothub_endpoint_eventhub.eventhub1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/endpoints/eventhub_endpoint1