diff --git a/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go b/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go index 334c3810449a..6e49d686191c 100644 --- a/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go +++ b/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource.go @@ -105,6 +105,12 @@ func resourceStreamAnalyticsReferenceMsSql() *pluginsdk.Resource { Optional: true, ValidateFunc: validation.StringIsNotEmpty, }, + + "table": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, }, } } @@ -158,6 +164,10 @@ func resourceStreamAnalyticsReferenceInputMsSqlCreateUpdate(d *pluginsdk.Resourc properties.DeltaSnapshotQuery = utils.String(v.(string)) } + if v, ok := d.GetOk("table"); ok { + properties.Table = utils.String(v.(string)) + } + props := streamanalytics.Input{ Name: utils.String(id.InputName), Properties: &streamanalytics.ReferenceInputProperties{ @@ -221,6 +231,7 @@ func resourceStreamAnalyticsReferenceInputMsSqlRead(d *pluginsdk.ResourceData, m d.Set("refresh_interval_duration", inputDataSource.AzureSQLReferenceInputDataSourceProperties.RefreshRate) d.Set("full_snapshot_query", inputDataSource.AzureSQLReferenceInputDataSourceProperties.FullSnapshotQuery) d.Set("delta_snapshot_query", inputDataSource.AzureSQLReferenceInputDataSourceProperties.DeltaSnapshotQuery) + d.Set("table", inputDataSource.AzureSQLReferenceInputDataSourceProperties.Table) } return nil } diff --git a/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource_test.go b/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource_test.go index b9900f7856c2..834dbf14f62a 100644 --- a/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_reference_input_mssql_resource_test.go @@ -51,6 +51,21 @@ func TestAccStreamAnalyticsReferenceInputMsSql_update(t *testing.T) { }) } +func TestAccStreamAnalyticsReferenceInputMsSql_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_stream_analytics_reference_input_mssql", "test") + r := StreamAnalyticsReferenceInputMsSqlResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep("password"), + }) +} + func TestAccStreamAnalyticsReferenceInputMsSql_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_stream_analytics_reference_input_mssql", "test") r := StreamAnalyticsReferenceInputMsSqlResource{} @@ -137,6 +152,32 @@ QUERY `, template, data.RandomInteger) } +func (r StreamAnalyticsReferenceInputMsSqlResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%s + +resource "azurerm_analytics_reference_input_mssql" "test" { + name = "acctestinput-%d" + stream_analytics_job_name = azurerm_stream_analytics_job.test.name + resource_group_name = azurerm_stream_analytics_job.test.resource_group_name + server = azurerm_mssql_server.test.fully_qualified_domain_name + database = azurerm_mssql_database.test.name + username = "maurice" + password = "ludicrousdisplay" + refresh_type = "RefreshPeriodicallyWithFull" + refresh_interval_duration = "00:10:00" + table = "exampletable" + full_snapshot_query = <