Skip to content

azurermKustoEventgridDataConnection

Manages a Kusto (also known as Azure Data Explorer) Event Grid 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 azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "GRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "storageaccountname",
    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 azurermEventhubNamespaceExample =
  new azurerm.eventhubNamespace.EventhubNamespace(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "eventhubnamespace-example",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermEventhubNamespaceExample.overrideLogicalId("example");
const azurermKustoClusterExample = new azurerm.kustoCluster.KustoCluster(
  this,
  "example_3",
  {
    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_4",
  {
    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 azurermEventhubExample = new azurerm.eventhub.Eventhub(
  this,
  "example_5",
  {
    message_retention: 1,
    name: "eventhub-example",
    namespace_name: azurermEventhubNamespaceExample.name,
    partition_count: 1,
    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.*/
azurermEventhubExample.overrideLogicalId("example");
const azurermEventhubConsumerGroupExample =
  new azurerm.eventhubConsumerGroup.EventhubConsumerGroup(this, "example_6", {
    eventhub_name: azurermEventhubExample.name,
    name: "consumergroup-example",
    namespace_name: azurermEventhubNamespaceExample.name,
    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.*/
azurermEventhubConsumerGroupExample.overrideLogicalId("example");
const azurermEventgridEventSubscriptionExample =
  new azurerm.eventgridEventSubscription.EventgridEventSubscription(
    this,
    "example_7",
    {
      event_delivery_schema: "EventGridSchema",
      eventhub_endpoint_id: azurermEventhubExample.id,
      included_event_types: [
        "Microsoft.Storage.BlobCreated",
        "Microsoft.Storage.BlobRenamed",
      ],
      name: "eventgrid-example",
      retry_policy: [
        {
          event_time_to_live: 144,
          max_delivery_attempts: 10,
        },
      ],
      scope: azurermStorageAccountExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermEventgridEventSubscriptionExample.overrideLogicalId("example");
const azurermKustoEventgridDataConnectionExample =
  new azurerm.kustoEventgridDataConnection.KustoEventgridDataConnection(
    this,
    "example_8",
    {
      cluster_name: azurermKustoClusterExample.name,
      data_format: "JSON",
      database_name: azurermKustoDatabaseExample.name,
      depends_on: [`\${${azurermEventgridEventSubscriptionExample.fqn}}`],
      eventhub_consumer_group_name: azurermEventhubConsumerGroupExample.name,
      eventhub_id: azurermEventhubExample.id,
      location: azurermResourceGroupExample.location,
      mapping_rule_name: "my-table-mapping",
      name: "my-kusto-eventgrid-data-connection",
      resource_group_name: azurermResourceGroupExample.name,
      storage_account_id: azurermStorageAccountExample.id,
      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.*/
azurermKustoEventgridDataConnectionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Kusto Event Grid 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.

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

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

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

  • blobStorageEventType - (Optional) Specifies the blob storage event type that needs to be processed. Possible Values are microsoftStorageBlobCreated and microsoftStorageBlobRenamed. Defaults to microsoftStorageBlobCreated.

  • dataFormat - (Optional) Specifies the data format of the EventHub messages. Allowed values: apacheavro, avro, csv, json, multijson, orc, parquet, psv, raw, scsv, singlejson, sohsv, tsv, tsve, txt and w3Clogfile.

  • 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.

  • eventgridResourceId - (Optional) The resource ID of the event grid that is subscribed to the storage account events.

  • managedIdentityResourceId - (Optional) Empty for non-managed identity based data connection. For system assigned identity, provide cluster resource Id. For user assigned identity (UAI) provide the UAI resource Id.

  • mappingRuleName - (Optional) Specifies the mapping rule used for the message ingestion. Mapping rule must exist before resource is created.

  • tableName - (Optional) Specifies the target table name used for the message ingestion. Table must exist before resource is created.

  • skipFirstRecord - (Optional) is the first record of every file ignored? Defaults to false.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Kusto Event Grid Data Connection.

Timeouts

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

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

Import

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

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