diff --git a/internal/services/kusto/kusto_iothub_data_connection_resource.go b/internal/services/kusto/kusto_iothub_data_connection_resource.go index 93e87a84609a..8a70245a3085 100644 --- a/internal/services/kusto/kusto_iothub_data_connection_resource.go +++ b/internal/services/kusto/kusto_iothub_data_connection_resource.go @@ -121,6 +121,17 @@ func resourceKustoIotHubDataConnection() *pluginsdk.Resource { }, false), }, + "database_routing_type": { + Type: pluginsdk.TypeString, + Optional: true, + ForceNew: true, + Default: string(kusto.DatabaseRoutingSingle), + ValidateFunc: validation.StringInSlice([]string{ + string(kusto.DatabaseRoutingSingle), + string(kusto.DatabaseRoutingMulti), + }, false), + }, + "event_system_properties": { Type: pluginsdk.TypeSet, Optional: true, @@ -173,6 +184,10 @@ func resourceKustoIotHubDataConnectionCreate(d *pluginsdk.ResourceData, meta int IotHubConnectionProperties: iotHubDataConnectionProperties, } + if databaseRouting, ok := d.GetOk("database_routing_type"); ok { + dataConnection.DatabaseRouting = kusto.DatabaseRouting(databaseRouting.(string)) + } + future, err := client.CreateOrUpdate(ctx, id.ResourceGroup, id.ClusterName, id.DatabaseName, id.Name, dataConnection) if err != nil { return fmt.Errorf("creating or updating %s: %+v", id, err) @@ -218,6 +233,7 @@ func resourceKustoIotHubDataConnectionRead(d *pluginsdk.ResourceData, meta inter d.Set("table_name", props.TableName) d.Set("mapping_rule_name", props.MappingRuleName) d.Set("data_format", props.DataFormat) + d.Set("database_routing_type", props.DatabaseRouting) d.Set("shared_access_policy_name", props.SharedAccessPolicyName) d.Set("event_system_properties", utils.FlattenStringSlice(props.EventSystemProperties)) } diff --git a/internal/services/kusto/kusto_iothub_data_connection_resource_test.go b/internal/services/kusto/kusto_iothub_data_connection_resource_test.go index cb022f3c9a2b..0a72cef65ead 100644 --- a/internal/services/kusto/kusto_iothub_data_connection_resource_test.go +++ b/internal/services/kusto/kusto_iothub_data_connection_resource_test.go @@ -39,6 +39,7 @@ func TestAccKustoIotHubDataConnection_complete(t *testing.T) { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("database_routing_type").HasValue("Multi"), ), }, data.ImportStep(), @@ -99,6 +100,7 @@ resource "azurerm_kusto_iothub_data_connection" "test" { event_system_properties = ["message-id", "sequence-number", "to"] mapping_rule_name = "Json_Mapping" data_format = "MULTIJSON" + database_routing_type = "Multi" } `, r.template(data), data.RandomInteger) } diff --git a/website/docs/r/kusto_iothub_data_connection.html.markdown b/website/docs/r/kusto_iothub_data_connection.html.markdown index 1d1297f5815f..9ee882fd319d 100644 --- a/website/docs/r/kusto_iothub_data_connection.html.markdown +++ b/website/docs/r/kusto_iothub_data_connection.html.markdown @@ -110,6 +110,8 @@ The following arguments are supported: * `data_format` - (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`. +* `database_routing_type` - (Optional) Indication for database routing information from the data connection, by default only database routing information is allowed. Allowed values: `Single`, `Multi`. + ## Attributes Reference The following attributes are exported: