-
Notifications
You must be signed in to change notification settings - Fork 365
/
data_zones.go
37 lines (34 loc) · 887 Bytes
/
data_zones.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package clusters
import (
"context"
"github.com/databricks/terraform-provider-databricks/common"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
// DataSourceClusterZones ...
func DataSourceClusterZones() common.Resource {
return common.Resource{
Read: func(ctx context.Context, d *schema.ResourceData, m *common.DatabricksClient) error {
zonesInfo, err := NewClustersAPI(ctx, m).ListZones()
if err != nil {
return err
}
d.SetId(zonesInfo.DefaultZone)
d.Set("default_zone", zonesInfo.DefaultZone)
d.Set("zones", zonesInfo.Zones)
return nil
},
Schema: map[string]*schema.Schema{
"default_zone": {
Type: schema.TypeString,
Computed: true,
ForceNew: true,
},
"zones": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
ForceNew: true,
},
},
}
}