diff --git a/clusters/data_clusters.go b/clusters/data_clusters.go index da637762b5..45e41a432c 100644 --- a/clusters/data_clusters.go +++ b/clusters/data_clusters.go @@ -13,7 +13,7 @@ func DataSourceClusters() common.Resource { return common.WorkspaceData(func(ctx context.Context, data *struct { Id string `json:"id,omitempty" tf:"computed"` Ids []string `json:"ids,omitempty" tf:"computed,slice_set"` - ClusterNameContains string `json:"cluster_name_contains"` + ClusterNameContains string `json:"cluster_name_contains,omitempty"` }, w *databricks.WorkspaceClient) error { clusters, err := w.Clusters.ListAll(ctx, compute.ListClustersRequest{}) if err != nil { diff --git a/internal/acceptance/data_clusters_test.go b/internal/acceptance/data_clusters_test.go new file mode 100644 index 0000000000..968f3dc0d7 --- /dev/null +++ b/internal/acceptance/data_clusters_test.go @@ -0,0 +1,22 @@ +package acceptance + +import ( + "testing" +) + +func TestAccDataSourceClustersNoFilter(t *testing.T) { + workspaceLevel(t, step{ + Template: ` + data "databricks_clusters" "this" { + } `, + }) +} + +func TestAccDataSourceClustersWithFilter(t *testing.T) { + workspaceLevel(t, step{ + Template: ` + data "databricks_clusters" "this" { + cluster_name_contains = "Default" + }`, + }) +}