Skip to content

azurermKustoIothubDataConnection

Manages a Kusto (also known as Azure Data Explorer) IotHub Data Connection

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 azurermIothubExample = new azurerm.iothub.Iothub(this, "example_1", {
  location: azurermResourceGroupExample.location,
  name: "exampleIoTHub",
  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_2", {
    eventhub_endpoint_name: "events",
    iothub_name: azurermIothubExample.name,
    name: "example-consumer-group",
    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 azurermIothubSharedAccessPolicyExample =
  new azurerm.iothubSharedAccessPolicy.IothubSharedAccessPolicy(
    this,
    "example_3",
    {
      iothub_name: azurermIothubExample.name,
      name: "example-shared-access-policy",
      registry_read: true,
      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.*/
azurermIothubSharedAccessPolicyExample.overrideLogicalId("example");
const azurermKustoClusterExample = new azurerm.kustoCluster.KustoCluster(
  this,
  "example_4",
  {
    location: azurermResourceGroupExample.location,
    name: "examplekustocluster",
    resource_group_name: azurermResourceGroupExample.name,
    sku: [
      {
        capacity: 2,
        name: "Standard_D13_v2",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKustoClusterExample.overrideLogicalId("example");
const azurermKustoDatabaseExample = new azurerm.kustoDatabase.KustoDatabase(
  this,
  "example_5",
  {
    cluster_name: azurermKustoClusterExample.name,
    hot_cache_period: "P7D",
    location: azurermResourceGroupExample.location,
    name: "example-kusto-database",
    resource_group_name: azurermResourceGroupExample.name,
    soft_delete_period: "P31D",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKustoDatabaseExample.overrideLogicalId("example");
const azurermKustoIothubDataConnectionExample =
  new azurerm.kustoIothubDataConnection.KustoIothubDataConnection(
    this,
    "example_6",
    {
      cluster_name: azurermKustoClusterExample.name,
      consumer_group: azurermIothubConsumerGroupExample.name,
      data_format: "JSON",
      database_name: azurermKustoDatabaseExample.name,
      event_system_properties: ["message-id", "sequence-number", "to"],
      iothub_id: azurermIothubExample.id,
      location: azurermResourceGroupExample.location,
      mapping_rule_name: "my-table-mapping",
      name: "my-kusto-iothub-data-connection",
      resource_group_name: azurermResourceGroupExample.name,
      shared_access_policy_name: azurermIothubSharedAccessPolicyExample.name,
      table_name: "my-table",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermKustoIothubDataConnectionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Kusto IotHub Data Connection to create. Changing this forces a new resource to be created.

  • location - (Required) The location where the Kusto Database should be created. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) Specifies the Resource Group where the Kusto Database should exist. Changing this forces a new resource to be created.

  • clusterName - (Required) Specifies the name of the Kusto Cluster this data connection will be added to. Changing this forces a new resource to be created.

  • databaseName - (Required) Specifies the name of the Kusto Database this data connection will be added to. Changing this forces a new resource to be created.

  • iothubId - (Required) Specifies the resource id of the IotHub this data connection will use for ingestion. Changing this forces a new resource to be created.

  • consumerGroup - (Required) Specifies the IotHub consumer group this data connection will use for ingestion. Changing this forces a new resource to be created.

  • sharedAccessPolicyName - (Required) Specifies the IotHub Shared Access Policy this data connection will use for ingestion, which must have read permission. Changing this forces a new resource to be created.

  • eventSystemProperties - (Optional) Specifies the System Properties that each IoT Hub message should contain. Changing this forces a new resource to be created. Possible values are messageId, sequenceNumber, to, absoluteExpiryTime, iothubEnqueuedtime, correlationId, userId, iothubAck, iothubConnectionDeviceId, iothubConnectionAuthGenerationId and iothubConnectionAuthMethod.

  • tableName - (Optional) Specifies the target table name used for the message ingestion. Table must exist before resource is created. Changing this forces a new resource to be created.

  • mappingRuleName - (Optional) Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created. Changing this forces a new resource to be created.

  • dataFormat - (Optional) Specifies the data format of the IoTHub messages. Allowed values: apacheavro, avro, csv, json, multijson, orc, parquet, psv, raw, scsv, singlejson, sohsv, tsv, tsve, txt and w3Clogfile. Changing this forces a new resource to be created.

  • databaseRoutingType - (Optional) Indication for database routing information from the data connection, by default only database routing information is allowed. Allowed values: single, multi. Changing this forces a new resource to be created.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Kusto IotHub Data Connection.

Timeouts

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

  • create - (Defaults to 60 minutes) Used when creating the Kusto IotHub Data Connection.
  • read - (Defaults to 5 minutes) Used when retrieving the Kusto IotHub Data Connection.
  • delete - (Defaults to 60 minutes) Used when deleting the Kusto IotHub Data Connection.

Import

Kusto IotHub Data Connections can be imported using the resourceId, e.g.

terraform import azurerm_kusto_iothub_data_connection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/dataConnections/dataConnection1