Skip to content

azurermTimeSeriesInsightsEventSourceIothub

Manages an Azure IoT Time Series Insights IoTHub Event Source.

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",
  }
);
const azurermStorageAccountStorage = new azurerm.storageAccount.StorageAccount(
  this,
  "storage",
  {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "example",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
const azurermIotTimeSeriesInsightsGen2EnvironmentExample =
  new azurerm.iotTimeSeriesInsightsGen2Environment.IotTimeSeriesInsightsGen2Environment(
    this,
    "example_2",
    {
      id_properties: ["id"],
      location: azurermResourceGroupExample.location,
      name: "example",
      resource_group_name: azurermResourceGroupExample.name,
      sku_name: "L1",
      storage: [
        {
          key: azurermStorageAccountStorage.primaryAccessKey,
          name: azurermStorageAccountStorage.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.*/
azurermIotTimeSeriesInsightsGen2EnvironmentExample.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: "B1",
    },
  ],
});
/*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 azurermIothubConsumerGroupExample =
  new azurerm.iothubConsumerGroup.IothubConsumerGroup(this, "example_4", {
    eventhub_endpoint_name: "events",
    iothub_name: azurermIothubExample.name,
    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.*/
azurermIothubConsumerGroupExample.overrideLogicalId("example");
const azurermIotTimeSeriesInsightsEventSourceIothubExample =
  new azurerm.iotTimeSeriesInsightsEventSourceIothub.IotTimeSeriesInsightsEventSourceIothub(
    this,
    "example_5",
    {
      consumer_group_name: azurermIothubConsumerGroupExample.name,
      environment_id: azurermIotTimeSeriesInsightsGen2EnvironmentExample.id,
      event_source_resource_id: azurermIothubExample.id,
      iothub_name: azurermIothubExample.name,
      location: azurermResourceGroupExample.location,
      name: "example",
      shared_access_key: `\${${azurermIothubExample.sharedAccessPolicy}.0.primary_key}`,
      shared_access_key_name: `\${${azurermIothubExample.sharedAccessPolicy}.0.key_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.*/
azurermIotTimeSeriesInsightsEventSourceIothubExample.overrideLogicalId(
  "example"
);

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Azure IoT Time Series Insights IoTHub Event Source. Changing this forces a new resource to be created. Must be globally unique.

  • environmentId - (Required) Specifies the id of the IoT Time Series Insights Environment that the Event Source should be associated with. Changing this forces a new resource to created.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • iothubName - (Required) Specifies the name of the IotHub which will be associated with this resource.

  • consumerGroupName - (Required) Specifies the name of the IotHub Consumer Group that holds the partitions from which events will be read.

  • eventSourceResourceId - (Required) Specifies the resource id where events will be coming from.

  • sharedAccessKeyName - (Required) Specifies the name of the Shared Access key that grants the Event Source access to the IotHub.

  • sharedAccessKey - (Required) Specifies the value of the Shared Access Policy key that grants the Time Series Insights service read access to the IotHub.

  • timestampPropertyName - (Optional) Specifies the value that will be used as the event source's timestamp. This value defaults to the event creation time.

  • tags - (Optional) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The ID of the IoT Time Series Insights IoTHub Event Source.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the IoT Time Series Insights IoTHub Event Source.
  • update - (Defaults to 30 minutes) Used when updating the IoT Time Series Insights IoTHub Event Source.
  • read - (Defaults to 5 minutes) Used when retrieving the IoT Time Series Insights IoTHub Event Source.
  • delete - (Defaults to 30 minutes) Used when deleting the IoT Time Series Insights IoTHub Event Source.

Import

Azure IoT Time Series Insights IoTHub Event Source can be imported using the resourceId, e.g.

terraform import azurerm_iot_time_series_insights_event_source_iothub.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.TimeSeriesInsights/environments/environment1/eventSources/example