Skip to content

azurermIothubEndpointStorageContainer

Manages an IotHub Storage Container 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 azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    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.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermStorageContainerExample =
  new azurerm.storageContainer.StorageContainer(this, "example_2", {
    container_access_type: "private",
    name: "acctestcont",
    storage_account_name: azurermStorageAccountExample.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.*/
azurermStorageContainerExample.overrideLogicalId("example");
const azurermIothubExample = new azurerm.iothub.Iothub(this, "example_3", {
  location: azurermResourceGroupExample.location,
  name: "example",
  resource_group_name: azurermResourceGroupExample.name,
  sku: [
    {
      capacity: "1",
      name: "S1",
    },
  ],
});
/*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 azurermIothubEndpointStorageContainerExample =
  new azurerm.iothubEndpointStorageContainer.IothubEndpointStorageContainer(
    this,
    "example_4",
    {
      batch_frequency_in_seconds: 60,
      connection_string:
        azurermStorageAccountExample.primaryBlobConnectionString,
      container_name: "acctestcont",
      encoding: "JSON",
      file_name_format: "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}",
      iothub_id: azurermIothubExample.id,
      max_chunk_size_in_bytes: 10485760,
      name: "acctest",
      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.*/
azurermIothubEndpointStorageContainerExample.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 Storage Container has been created. Changing this forces a new resource to be created.

  • containerName - (Required) The name of storage container in the storage account.

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

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

  • identityId - (Optional) ID of the User Managed Identity used to authenticate against the storage 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 Storage Container endpoint. This corresponds to the primaryBlobEndpoint of the parent storage account. 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.

  • batchFrequencyInSeconds - (Optional) Time interval at which blobs are written to storage. Value should be between 60 and 720 seconds. Default value is 300 seconds.

  • maxChunkSizeInBytes - (Optional) Maximum number of bytes for each blob written to storage. Value should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB).

  • encoding - (Optional) Encoding that is used to serialize messages to blobs. Supported values are avro, avroDeflate and json. Default value is avro. Changing this forces a new resource to be created.

  • fileNameFormat - (Optional) File name format for the blob. Default format is {iothub}/{partition}/{yyyy}/{mm}/{dd}/{hh}/{mm}. All parameters are mandatory but can be reordered.

Attributes Reference

The following attributes are exported:

  • id - The ID of the IoTHub Storage Container Endpoint.

Timeouts

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

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

Import

IoTHub Storage Container Endpoint can be imported using the resourceId, e.g.

terraform import azurerm_iothub_endpoint_storage_container.storage_container1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/endpoints/storage_container_endpoint1