diff --git a/catalog/resource_metastore_assignment.go b/catalog/resource_metastore_assignment.go index 9f8d48a2af..28257d47b9 100644 --- a/catalog/resource_metastore_assignment.go +++ b/catalog/resource_metastore_assignment.go @@ -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 }) }, diff --git a/catalog/resource_metastore_assignment_test.go b/catalog/resource_metastore_assignment_test.go index ebc6358d0b..4de04588bb 100644 --- a/catalog/resource_metastore_assignment_test.go +++ b/catalog/resource_metastore_assignment_test.go @@ -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{ diff --git a/docs/resources/metastore_assignment.md b/docs/resources/metastore_assignment.md index 614f83b04c..43541d02b9 100644 --- a/docs/resources/metastore_assignment.md +++ b/docs/resources/metastore_assignment.md @@ -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 `|`. +* `id` - ID of this metastore assignment in form of `|`. ## Import