Skip to content

Commit 5bb34c1

Browse files
authored
Added gcs destination to init_scripts in databricks_cluster (#1308)
1 parent 88e3a1e commit 5bb34c1

File tree

6 files changed

+219
-7
lines changed

6 files changed

+219
-7
lines changed

.devcontainer/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ RUN \
3737
# # --> Go symbols and outline for go to symbol support and test support
3838
&& go install github.com/acroca/[email protected] \
3939
# # --> Static checker
40-
&& go install honnef.co/go/tools/cmd/[email protected]
40+
&& go install honnef.co/go/tools/cmd/[email protected] \
41+
# # --> TF formatter
42+
&& go get github.com/katbyte/terrafmt

clusters/clusters_api.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ type S3StorageInfo struct {
186186
CannedACL string `json:"canned_acl,omitempty"`
187187
}
188188

189+
// GcsStorageInfo contains the struct for when storing files in GCS
190+
type GcsStorageInfo struct {
191+
Destination string `json:"destination,omitempty" tf:"optional"`
192+
}
193+
189194
// LocalFileInfo represents a local file on disk, e.g. in a customer's container.
190195
type LocalFileInfo struct {
191196
Destination string `json:"destination,omitempty" tf:"optional"`
@@ -200,6 +205,7 @@ type StorageInfo struct {
200205
// InitScriptStorageInfo captures the allowed sources of init scripts.
201206
type InitScriptStorageInfo struct {
202207
Dbfs *DbfsStorageInfo `json:"dbfs,omitempty" tf:"group:storage"`
208+
Gcs *GcsStorageInfo `json:"gcs,omitempty" tf:"group:storage"`
203209
S3 *S3StorageInfo `json:"s3,omitempty" tf:"group:storage"`
204210
File *LocalFileInfo `json:"file,omitempty" tf:"optional"`
205211
}

docs/resources/cluster.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ There are a few more advanced attributes for S3 log delivery:
242242

243243
## init_scripts
244244

245-
You can specify up to 10 different init scripts for the specific cluster. If you want a shell script to run on all clusters and jobs within the same workspace, you should consider [databricks_global_init_script](global_init_script.md).
245+
To run a particular init script on all clusters within the same workspace, both automated/job and interactive/all-purpose cluster types, please consider the [databricks_global_init_script](global_init_script.md) resource.
246+
247+
It is possible to specify up to 10 different cluster-scoped init scripts per cluster. Like the `cluster_log_conf` configuration block, init scripts support DBFS and cloud storage locations.
246248

247249
Example of taking init script from DBFS:
248250
```hcl
@@ -263,7 +265,16 @@ init_scripts {
263265
}
264266
```
265267

266-
Like the `cluster_log_conf` configuration block, init scripts support S3 and DBFS locations. In addition, you can also specify a local file as follows:
268+
Similarly, for an init script stored in GCS:
269+
```hcl
270+
init_scripts {
271+
gcs {
272+
destination = "gs://init-scripts/install-elk.sh"
273+
}
274+
}
275+
```
276+
277+
Clusters with [custom Docker containers](https://docs.databricks.com/clusters/custom-containers.html) also allow a local file location for init scripts as follows:
267278

268279
```hcl
269280
init_scripts {
@@ -273,8 +284,6 @@ init_scripts {
273284
}
274285
```
275286

276-
Take note that this can only be specified for clusters with [custom Docker containers](https://docs.databricks.com/clusters/custom-containers.html).
277-
278287
## aws_attributes
279288

280289
`aws_attributes` optional configuration block contains attributes related to [clusters running on Amazon Web Services](https://docs.databricks.com/clusters/configure.html#aws-configurations).

docs/resources/mws_networks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resource "databricks_mws_networks" "this" {
8181
}
8282
depends_on = [aws_vpc_endpoint.workspace, aws_vpc_endpoint.relay]
8383
}
84-
```
84+
```
8585

8686
## Modifying networks on running workspaces
8787

0 commit comments

Comments
 (0)