Skip to content

Commit 20fafd6

Browse files
authored
[Internal] Add remaining data sources to unified provider (#5181)
## Changes <!-- Summary of your changes that are easy to understand --> All manually maintained data sources that doesn't use `WorkspaceData` to unified provider. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> Integration tests NO_CHANGELOG=true
1 parent 6165376 commit 20fafd6

23 files changed

+358
-169
lines changed

common/datasource.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ func DataResource(sc any, read func(context.Context, any, *DatabricksClient) err
1515
s := StructToSchema(sc, func(m map[string]*schema.Schema) map[string]*schema.Schema {
1616
return m
1717
})
18+
AddNamespaceInSchema(s)
19+
NamespaceCustomizeSchemaMap(s)
1820
return Resource{
1921
Schema: s,
2022
Read: func(ctx context.Context, d *schema.ResourceData, m *DatabricksClient) (err error) {
23+
newClient, err := m.DatabricksClientForUnifiedProvider(ctx, d)
24+
if err != nil {
25+
return err
26+
}
2127
ptr := reflect.New(reflect.ValueOf(sc).Type())
2228
DataToReflectValue(d, s, ptr.Elem())
23-
err = read(ctx, ptr.Interface(), m)
29+
err = read(ctx, ptr.Interface(), newClient)
2430
if err != nil {
2531
err = nicerError(ctx, err, "read data")
2632
}

docs/data-sources/current_config.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ resource "databricks_storage_credential" "external" {
3939
}
4040
```
4141

42+
## Argument Reference
43+
44+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
45+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
46+
4247
## Exported attributes
4348

4449
Data source exposes the following attributes:

docs/data-sources/current_user.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ output "job_url" {
5555
}
5656
```
5757

58+
## Argument Reference
59+
60+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
61+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
62+
5863
## Exported attributes
5964

6065
Data source exposes the following attributes:

docs/data-sources/dbfs_file.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ data "databricks_dbfs_file" "report" {
2020

2121
* `path` - (Required) Path on DBFS for the file from which to get content.
2222
* `limit_file_size` - (Required - boolean) Do not load content for files larger than 4MB.
23+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
24+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
2325

2426
## Attribute Reference
2527

docs/data-sources/dbfs_file_paths.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ data "databricks_dbfs_file_paths" "partitions" {
2020

2121
* `path` - (Required) Path on DBFS for the file to perform listing
2222
* `recursive` - (Required) Either or not recursively list all files
23+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
24+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
2325

2426
## Attribute Reference
2527

docs/data-sources/group.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Data source allows you to pick groups by the following attributes
3232

3333
* `display_name` - (Required) Display name of the group. The group must exist before this resource can be planned.
3434
* `recursive` - (Optional) Collect information for all nested groups. *Defaults to true.*
35+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
36+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
3537

3638
## Attribute Reference
3739

docs/data-sources/instance_pool.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ resource "databricks_cluster" "my_cluster" {
2828
Data source allows you to pick instance pool by the following attribute
2929

3030
- `name` - Name of the instance pool. The instance pool must exist before this resource can be planned.
31+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
32+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
3133

3234
## Attribute Reference
3335

docs/data-sources/job.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ output "job_num_workers" {
2222
}
2323
```
2424

25+
## Argument Reference
26+
27+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
28+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
29+
2530
## Attribute Reference
2631

2732
This data source exports the following attributes:

docs/data-sources/mws_credentials.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ output "all_mws_credentials" {
2424
}
2525
```
2626

27+
## Argument Reference
28+
29+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
30+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
31+
2732
## Attribute Reference
2833

2934
-> This resource has an evolving interface, which may change in future versions of the provider.

docs/data-sources/mws_workspaces.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ output "all_mws_workspaces" {
2424
}
2525
```
2626

27+
## Argument Reference
28+
29+
* `provider_config` - (Optional) Configure the provider for management through account provider. This block consists of the following fields:
30+
* `workspace_id` - (Required) Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with.
31+
2732
## Attribute Reference
2833

2934
-> This resource has an evolving interface, which may change in future versions of the provider.

0 commit comments

Comments
 (0)