@@ -12,20 +12,21 @@ import (
1212
1313func DataSourceMetastore () common.Resource {
1414 type AccountMetastoreByID struct {
15- Id string `json:"metastore_id,omitempty" tf:"computed"`
16- Name string `json:"name,omitempty" tf:"computed"`
17- Region string `json:"region,omitempty" tf:"computed"`
18- Metastore * catalog.MetastoreInfo `json:"metastore_info,omitempty" tf:"computed" `
15+ Id string `json:"id,omitempty" tf:"computed"`
16+ MetastoreId string `json:"metastore_id,omitempty" tf:"computed"`
17+ Name string `json:"name,omitempty" tf:"computed"`
18+ Region string `json:"region,omitempty" tf:"computed"`
19+ Metastore * catalog.MetastoreInfo `json:"metastore_info,omitempty" tf:"computed" `
1920 }
2021 return common .AccountData (func (ctx context.Context , data * AccountMetastoreByID , acc * databricks.AccountClient ) error {
21- if data .Id == "" && data .Name == "" && data .Region == "" {
22+ if data .MetastoreId == "" && data .Name == "" && data .Region == "" {
2223 return fmt .Errorf ("one of metastore_id, name or region must be provided" )
2324 }
24- if (data .Id != "" && data .Name != "" ) || (data .Region != "" && data .Id != "" ) || (data .Region != "" && data .Name != "" ) {
25+ if (data .MetastoreId != "" && data .Name != "" ) || (data .Region != "" && data .MetastoreId != "" ) || (data .Region != "" && data .Name != "" ) {
2526 return fmt .Errorf ("only one of metastore_id, name or region must be provided" )
2627 }
27- if data .Id != "" {
28- minfo , err := acc .Metastores .GetByMetastoreId (ctx , data .Id )
28+ if data .MetastoreId != "" {
29+ minfo , err := acc .Metastores .GetByMetastoreId (ctx , data .MetastoreId )
2930 if err != nil {
3031 return err
3132 }
@@ -58,6 +59,7 @@ func DataSourceMetastore() common.Resource {
5859 data .Metastore = & minfos [0 ]
5960 }
6061 data .Id = data .Metastore .MetastoreId
62+ data .MetastoreId = data .Metastore .MetastoreId
6163 data .Name = data .Metastore .Name
6264 data .Region = data .Metastore .Region
6365 return nil
0 commit comments