Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] reading databricks_metastore_assignment when importing resource #3827

Merged
merged 1 commit into from
Jul 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions catalog/resource_metastore_assignment.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ func ResourceMetastoreAssignment() common.Resource {
return err
}
d.Set("metastore_id", ma.MetastoreId)
d.Set("default_catalog_name", ma.DefaultCatalogName)
d.Set("workspace_id", workspaceId)
return nil
})
},
Expand Down
23 changes: 23 additions & 0 deletions catalog/resource_metastore_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ func TestMetastoreAssignment_Create(t *testing.T) {
}.ApplyNoError(t)
}

func TestMetastoreAssignment_Import(t *testing.T) {
qa.ResourceFixture{
Fixtures: []qa.HTTPFixture{
{
Method: "GET",
Resource: "/api/2.1/unity-catalog/current-metastore-assignment",
Response: catalog.MetastoreAssignment{
MetastoreId: "a",
WorkspaceId: 123,
DefaultCatalogName: "test_metastore",
},
},
},
Resource: ResourceMetastoreAssignment(),
Read: true,
ID: "123|a",
}.ApplyAndExpectData(t, map[string]any{
"workspace_id": 123,
"metastore_id": "a",
"default_catalog_name": "test_metastore",
})
}

func TestMetastoreAssignmentAccount_Create(t *testing.T) {
qa.ResourceFixture{
Fixtures: []qa.HTTPFixture{
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/metastore_assignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The following arguments are required:

In addition to all arguments above, the following attributes are exported:

* `id` - ID of this metastore assignment in form of `<metastore_id>|<metastore_id>`.
* `id` - ID of this metastore assignment in form of `<workspace_id>|<metastore_id>`.

## Import

Expand Down
Loading