Skip to content

Commit

Permalink
Allow to disable auto-stop for SQL Endpoints (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexott authored Feb 14, 2022
1 parent 1bfabed commit 73fe251
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Added `workspace_url` attribute to the `databricks_current_user` data source ([#1107](https://github.com/databrickslabs/terraform-provider-databricks/pull/1107)).
* Fixed issue at `databricks_mount` where new cluster was created for S3 mount even when `cluster_id` was specified ([#1064](https://github.com/databrickslabs/terraform-provider-databricks/issues/1064)).
* Allow to disable auto-termination for Databricks SQL endpoints ([#900](https://github.com/databrickslabs/terraform-provider-databricks/pull/900)).

## 0.4.9

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/sql_endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following arguments are supported:
* `cluster_size` - (Required) The size of the clusters allocated to the endpoint: "2X-Small", "X-Small", "Small", "Medium", "Large", "X-Large", "2X-Large", "3X-Large", "4X-Large".
* `min_num_clusters` - Minimum number of clusters available when a SQL endpoint is running. The default is `1`.
* `max_num_clusters` - Maximum number of clusters available when a SQL endpoint is running. This field is required. If multi-cluster load balancing is not enabled, this is default to `1`.
* `auto_stop_mins` - Time in minutes until an idle SQL endpoint terminates all clusters and stops. This field is optional. The default is 0, which means auto stop is disabled.
* `auto_stop_mins` - Time in minutes until an idle SQL endpoint terminates all clusters and stops. This field is optional. The default is 120, set to 0 to disable the auto stop.
* `instance_profile_arn` - [databricks_instance_profile](instance_profile.md) used to access storage from the SQL endpoint. This field is optional.
* `tags` - Databricks tags all endpoint resources with these tags.
* `spot_instance_policy` - The spot policy to use for allocating instances to clusters: `COST_OPTIMIZED` or `RELIABILITY_OPTIMIZED`. This field is optional. Default is `COST_OPTIMIZED`.
Expand Down
4 changes: 3 additions & 1 deletion sql/resource_sql_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type SQLEndpoint struct {
ID string `json:"id,omitempty" tf:"computed"`
Name string `json:"name"`
ClusterSize string `json:"cluster_size"`
AutoStopMinutes int `json:"auto_stop_mins,omitempty" tf:"default:120"`
AutoStopMinutes int `json:"auto_stop_mins" tf:"default:120"`
MinNumClusters int `json:"min_num_clusters,omitempty" tf:"default:1"`
MaxNumClusters int `json:"max_num_clusters,omitempty" tf:"default:1"`
NumClusters int `json:"num_clusters,omitempty" tf:"default:1"`
Expand Down Expand Up @@ -191,6 +191,8 @@ func (a SQLEndpointsAPI) Delete(endpointID string) error {
func ResourceSQLEndpoint() *schema.Resource {
s := common.StructToSchema(SQLEndpoint{}, func(
m map[string]*schema.Schema) map[string]*schema.Schema {
m["auto_stop_mins"].Required = false
m["auto_stop_mins"].Optional = true
m["cluster_size"].ValidateDiagFunc = validation.ToDiagFunc(
validation.StringInSlice(ClusterSizes, false))
m["max_num_clusters"].ValidateDiagFunc = validation.ToDiagFunc(
Expand Down

0 comments on commit 73fe251

Please sign in to comment.