Skip to content

Commit 5b0e526

Browse files
authored
Added warehouse_type parameter to databricks_sql_endpoint to support PRO SKU (#1728)
1 parent cfeae64 commit 5b0e526

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

docs/resources/sql_endpoint.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The following arguments are supported:
3939
* `enable_serverless_compute` - Whether this SQL endpoint is a Serverless endpoint. To use a Serverless SQL endpoint, you must enable Serverless SQL endpoints for the workspace.
4040
* `channel` block, consisting of following fields:
4141
* `name` - Name of the Databricks SQL release channel. Possible values are: `CHANNEL_NAME_PREVIEW` and `CHANNEL_NAME_CURRENT`. Default is `CHANNEL_NAME_CURRENT`.
42+
* `warehouse_type` - [SQL Warehouse Type](https://docs.databricks.com/sql/admin/sql-endpoints.html#switch-the-sql-warehouse-type-pro-classic-or-serverless): `PRO` (default) or `CLASSIC`. If Serverless SQL is enabled, you can only specify `PRO`.
4243

4344
## Attribute Reference
4445

sql/resource_sql_endpoint.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type SQLEndpoint struct {
3737
Tags *Tags `json:"tags,omitempty" tf:"suppress_diff"`
3838
SpotInstancePolicy string `json:"spot_instance_policy,omitempty" tf:"default:COST_OPTIMIZED"`
3939
Channel *ReleaseChannel `json:"channel,omitempty" tf:"suppress_diff"`
40+
WarehouseType string `json:"warehouse_type,omitempty" tf:"default:PRO"`
4041

4142
// The data source ID is not part of the endpoint API response.
4243
// We manually resolve it by retrieving the list of data sources
@@ -76,7 +77,6 @@ type Tag struct {
7677
//
7778
// Note: this object returns more fields than contained in this struct,
7879
// but we only list the ones that are in use here.
79-
//
8080
type DataSource struct {
8181
ID string `json:"id"`
8282
EndpointID string `json:"endpoint_id"`
@@ -198,6 +198,8 @@ func ResourceSqlEndpoint() *schema.Resource {
198198
validation.StringInSlice(ClusterSizes, false))
199199
m["max_num_clusters"].ValidateDiagFunc = validation.ToDiagFunc(
200200
validation.IntBetween(1, MaxNumClusters))
201+
m["warehouse_type"].ValidateDiagFunc = validation.ToDiagFunc(
202+
validation.StringInSlice([]string{"PRO", "CLASSIC"}, false))
201203
return m
202204
})
203205
return common.Resource{

sql/resource_sql_endpoint_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ func TestResourceSQLEndpointCreate(t *testing.T) {
8181
NumClusters: 1,
8282
EnablePhoton: true,
8383
SpotInstancePolicy: "COST_OPTIMIZED",
84+
WarehouseType: "PRO",
8485
},
8586
Response: SQLEndpoint{
8687
ID: "abc",
@@ -128,6 +129,7 @@ func TestResourceSQLEndpointCreateNoAutoTermination(t *testing.T) {
128129
NumClusters: 1,
129130
EnablePhoton: true,
130131
SpotInstancePolicy: "COST_OPTIMIZED",
132+
WarehouseType: "PRO",
131133
},
132134
Response: SQLEndpoint{
133135
ID: "abc",
@@ -228,6 +230,7 @@ func TestResourceSQLEndpointUpdate(t *testing.T) {
228230
NumClusters: 1,
229231
EnablePhoton: true,
230232
SpotInstancePolicy: "COST_OPTIMIZED",
233+
WarehouseType: "PRO",
231234
},
232235
},
233236
{

0 commit comments

Comments
 (0)