Skip to content

azurermStreamAnalyticsReferenceInputMssql

Manages a Stream Analytics Reference Input from MS SQL. Reference data (also known as a lookup table) is a finite data set that is static or slowly changing in nature, used to perform a lookup or to correlate with your data stream. Learn more here.

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 dataAzurermStreamAnalyticsJobExample =
  new azurerm.dataAzurermStreamAnalyticsJob.DataAzurermStreamAnalyticsJob(
    this,
    "example_1",
    {
      name: "example-job",
      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.*/
dataAzurermStreamAnalyticsJobExample.overrideLogicalId("example");
const azurermMssqlServerExample = new azurerm.mssqlServer.MssqlServer(
  this,
  "example_2",
  {
    administrator_login: "admin",
    administrator_login_password: "password",
    location: azurermResourceGroupExample.location,
    name: "example-sqlserver",
    resource_group_name: azurermResourceGroupExample.name,
    version: "12.0",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMssqlServerExample.overrideLogicalId("example");
const azurermMssqlDatabaseExample = new azurerm.mssqlDatabase.MssqlDatabase(
  this,
  "example_3",
  {
    name: "example-db",
    server_id: azurermMssqlServerExample.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.*/
azurermMssqlDatabaseExample.overrideLogicalId("example");
const azurermStreamAnalyticsReferenceInputMssqlExample =
  new azurerm.streamAnalyticsReferenceInputMssql.StreamAnalyticsReferenceInputMssql(
    this,
    "example_4",
    {
      database: azurermMssqlDatabaseExample.name,
      full_snapshot_query:
        "    SELECT *\n    INTO [YourOutputAlias]\n    FROM [YourInputAlias]\n",
      name: "example-reference-input",
      password: "examplepassword",
      refresh_interval_duration: "00:20:00",
      refresh_type: "RefreshPeriodicallyWithFull",
      resource_group_name:
        dataAzurermStreamAnalyticsJobExample.resourceGroupName,
      server: azurermMssqlServerExample.fullyQualifiedDomainName,
      stream_analytics_job_name: dataAzurermStreamAnalyticsJobExample.name,
      username: "exampleuser",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStreamAnalyticsReferenceInputMssqlExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name of the Reference Input MS SQL data. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the Resource Group where the Stream Analytics Job should exist. Changing this forces a new resource to be created.

  • streamAnalyticsJobName - (Required) The name of the Stream Analytics Job. Changing this forces a new resource to be created.

  • server - (Required) The fully qualified domain name of the MS SQL server.

  • database - (Required) The MS SQL database name where the reference data exists.

  • username - (Required) The username to connect to the MS SQL database.

  • password - (Required) The password to connect to the MS SQL database.

  • refreshType - (Required) Defines whether and how the reference data should be refreshed. Accepted values are static, refreshPeriodicallyWithFull and refreshPeriodicallyWithDelta.

  • refreshIntervalDuration - (Optional) The frequency in hh:mm:ss with which the reference data should be retrieved from the MS SQL database e.g. 00:20:00 for every 20 minutes. Must be set when refreshType is refreshPeriodicallyWithFull or refreshPeriodicallyWithDelta.

  • fullSnapshotQuery - (Required) The query used to retrieve the reference data from the MS SQL database.

  • deltaSnapshotQuery - (Optional) The query used to retrieve incremental changes in the reference data from the MS SQL database. Cannot be set when refreshType is static.

  • table - (Optional) The name of the table in the Azure SQL database.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Stream Analytics.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Stream Analytics.
  • read - (Defaults to 5 minutes) Used when retrieving the Stream Analytics.
  • update - (Defaults to 30 minutes) Used when updating the Stream Analytics.
  • delete - (Defaults to 30 minutes) Used when deleting the Stream Analytics.

Import

Stream Analytics can be imported using the resourceId, e.g.

terraform import azurerm_stream_analytics_reference_input_mssql.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.StreamAnalytics/streamingJobs/job1/inputs/input1