Skip to content

Commit 6294f0a

Browse files
committed
direct: Handle data_security_mode aliases for clusters
1 parent c9d9723 commit 6294f0a

File tree

10 files changed

+32
-110
lines changed

10 files changed

+32
-110
lines changed

acceptance/bundle/resources/clusters/deploy/data_security_mode/out.direct-exp.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

acceptance/bundle/resources/clusters/deploy/data_security_mode/out.plan.direct-exp.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

acceptance/bundle/resources/clusters/deploy/data_security_mode/out.plan.terraform.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

acceptance/bundle/resources/clusters/deploy/data_security_mode/out.requests.direct-exp.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

acceptance/bundle/resources/clusters/deploy/data_security_mode/out.requests.terraform.txt

Lines changed: 0 additions & 30 deletions
This file was deleted.

acceptance/bundle/resources/clusters/deploy/data_security_mode/out.terraform.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

acceptance/bundle/resources/clusters/deploy/data_security_mode/output.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11

2+
>>> [CLI] bundle deploy
3+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files...
4+
Deploying resources...
5+
Updating deployment state...
6+
Deployment complete!
7+
8+
>>> [CLI] bundle plan
9+
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged
10+
11+
>>> [CLI] bundle deploy
12+
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files...
13+
Deploying resources...
14+
Updating deployment state...
15+
Deployment complete!
16+
217
>>> [CLI] bundle destroy --auto-approve
318
The following resources will be deleted:
419
delete cluster test_cluster

acceptance/bundle/resources/clusters/deploy/data_security_mode/script

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ cleanup() {
66
}
77
trap cleanup EXIT
88

9-
trace $CLI bundle deploy > out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
10-
print_requests.py --get //clusters > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt
11-
12-
trace $CLI bundle plan >> out.plan.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
13-
14-
trace errcode $CLI bundle deploy >> out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
15-
print_requests.py --get //clusters > out.requests.$DATABRICKS_BUNDLE_ENGINE.txt
9+
trace $CLI bundle deploy
10+
trace $CLI bundle plan
11+
trace $CLI bundle deploy

acceptance/bundle/resources/clusters/deploy/data_security_mode/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Local = false
22
Cloud = true
3-
RecordRequests = true
3+
RecordRequests = false
44

55
Ignore = [
66
"databricks.yml",

bundle/direct/dresources/cluster.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,24 @@ func (r *ResourceCluster) DoDelete(ctx context.Context, id string) error {
102102
}
103103

104104
func (r *ResourceCluster) ClassifyChange(change structdiff.Change, remoteState *compute.ClusterDetails, _ bool) (deployplan.ActionType, error) {
105+
changedPath := change.Path.String()
106+
if changedPath == "data_security_mode" {
107+
if change.Old == compute.DataSecurityModeDataSecurityModeStandard && change.New == compute.DataSecurityModeUserIsolation {
108+
return deployplan.ActionTypeSkip, nil
109+
}
110+
if change.Old == compute.DataSecurityModeDataSecurityModeDedicated && change.New == compute.DataSecurityModeSingleUser {
111+
return deployplan.ActionTypeSkip, nil
112+
}
113+
if change.Old == compute.DataSecurityModeDataSecurityModeAuto && (change.New == compute.DataSecurityModeSingleUser || change.New == compute.DataSecurityModeUserIsolation) {
114+
return deployplan.ActionTypeSkip, nil
115+
}
116+
}
117+
105118
// Always update if the cluster is not running.
106119
if remoteState.State != compute.StateRunning {
107120
return deployplan.ActionTypeUpdate, nil
108121
}
109122

110-
changedPath := change.Path.String()
111123
if changedPath == "num_workers" || strings.HasPrefix(changedPath, "autoscale") {
112124
return deployplan.ActionTypeResize, nil
113125
}

0 commit comments

Comments
 (0)