Manages the File Upload of an IoT Hub.
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_storage_account" "example" {
name = "examplestorage"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_storage_container" "example" {
name = "examplecontainer"
storage_account_name = azurerm_storage_account.example.name
container_access_type = "private"
}
resource "azurerm_iothub" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku {
name = "S1"
capacity = "1"
}
lifecycle {
ignore_changes = [
file_upload
]
}
}
resource "azurerm_iothub_file_upload" "example" {
iothub_id = azurerm_iothub.example.id
connection_string = azurerm_storage_account.example.primary_blob_connection_string
container_name = azurerm_storage_container.example.name
}
The following arguments are supported:
iothub_id
- (Required) The ID of the IoT Hub. Changing this forces a new IoT Hub to be created.
connection_string
- (Required) The connection string for the Azure Storage account to which files are uploaded.
container_name
- (Required) The name of the root container where the files should be uploaded to. The container need not exist but should be creatable using the connection_string
specified.
authentication_type
- (Optional) The type used to authenticate against the storage account. Possible values are keyBased
and identityBased
. Defaults to keyBased
.
default_ttl
- (Optional) The period of time for which a file upload notification message is available to consume before it expires, specified as an ISO 8601 timespan duration. This value must be between 1 minute and 48 hours. Defaults to PT1H
.
identity_id
- (Optional) The ID of the User Managed Identity used to authenticate against the storage account.
lock_duration
- (Optional) The lock duration for the file upload notifications queue, specified as an ISO 8601 timespan duration. This value must be between 5 and 300 seconds. Defaults to PT1M
.
max_delivery_count
- (Optional) The number of times the IoT Hub attempts to deliver a file upload notification message. Defaults to 10
.
notifications_enabled
- (Optional) Used to specify whether file notifications are sent to IoT Hub on upload. Defaults to false
.
sas_ttl
- (Optional) The period of time for which the SAS URI generated by IoT Hub for file upload is valid, specified as an ISO 8601 timespan duration. This value must be between 1 minute and 24 hours. Defaults to PT1H
.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the IoT Hub.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the IoT Hub.read
- (Defaults to 5 minutes) Used when retrieving the IoT Hub.update
- (Defaults to 30 minutes) Used when updating the IoT Hub.delete
- (Defaults to 30 minutes) Used when deleting the IoT Hub.IoT Hub File Uploads can be imported using the resource id
, e.g.
terraform import azurerm_iothub_file_upload.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1