Skip to content

Commit 10402f7

Browse files
authored
mark storage_root optional for databricks_metastore resource (#2873)
* make `storage_root` optional for `databricks_metastore` * fix struct
1 parent bf4d126 commit 10402f7

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

catalog/resource_metastore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
type MetastoreInfo struct {
1717
Name string `json:"name"`
18-
StorageRoot string `json:"storage_root" tf:"force_new"`
18+
StorageRoot string `json:"storage_root,omitempty" tf:"force_new"`
1919
DefaultDacID string `json:"default_data_access_config_id,omitempty" tf:"suppress_diff"`
2020
StorageRootCredentialId string `json:"storage_root_credential_id,omitempty" tf:"suppress_diff"`
2121
Owner string `json:"owner,omitempty" tf:"computed"`

docs/resources/metastore.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ resource "databricks_metastore_assignment" "this" {
6767
The following arguments are required:
6868

6969
* `name` - Name of metastore.
70-
* `storage_root` - Path on cloud storage account, where managed `databricks_table` are stored. Change forces creation of a new resource.
70+
* `storage_root` - (Optional) Path on cloud storage account, where managed `databricks_table` are stored. Change forces creation of a new resource.
7171
* `region` - (Mandatory for account-level) The region of the metastore
7272
* `owner` - (Optional) Username/groupname/sp application_id of the metastore owner.
7373
* `delta_sharing_scope` - (Optional) Required along with `delta_sharing_recipient_token_lifetime_in_seconds`. Used to enable delta sharing on the metastore. Valid values: INTERNAL, INTERNAL_AND_EXTERNAL.
@@ -80,6 +80,7 @@ The following arguments are required:
8080
In addition to all arguments above, the following attributes are exported:
8181

8282
* `id` - system-generated ID of this Unity Catalog Metastore.
83+
8384
## Import
8485

8586
This resource can be imported by ID:

internal/acceptance/metastore_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,35 @@ func TestUcAccMetastore(t *testing.T) {
3939
t.Skipf("not available on %s", cloudEnv)
4040
}
4141
}
42+
43+
func TestUcAccRootlessMetastore(t *testing.T) {
44+
cloudEnv := os.Getenv("CLOUD_ENV")
45+
switch cloudEnv {
46+
case "ucacct":
47+
unityAccountLevel(t, step{
48+
Template: `resource "databricks_metastore" "this" {
49+
name = "{var.RANDOM}"
50+
region = "us-east-1"
51+
force_destroy = true
52+
}`,
53+
})
54+
case "azure-ucacct":
55+
unityAccountLevel(t, step{
56+
Template: `resource "databricks_metastore" "this" {
57+
name = "{var.RANDOM}"
58+
region = "eastus"
59+
force_destroy = true
60+
}`,
61+
})
62+
case "gcp-accounts":
63+
unityAccountLevel(t, step{
64+
Template: `resource "databricks_metastore" "this" {
65+
name = "{var.RANDOM}"
66+
region = "us-east1"
67+
force_destroy = true
68+
}`,
69+
})
70+
default:
71+
t.Skipf("not available on %s", cloudEnv)
72+
}
73+
}

0 commit comments

Comments
 (0)