Skip to content

Commit 6683d6b

Browse files
committed
direct: Handle data_security_mode aliases for clusters
1 parent 14e8e43 commit 6683d6b

File tree

7 files changed

+31
-38
lines changed

7 files changed

+31
-38
lines changed

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

Lines changed: 0 additions & 12 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.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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ cleanup() {
55
}
66
trap cleanup EXIT
77

8-
trace $CLI bundle deploy > out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
9-
10-
trace $CLI bundle plan >> out.plan.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
11-
12-
trace errcode $CLI bundle deploy >> out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
8+
trace $CLI bundle deploy
9+
trace $CLI bundle plan
10+
trace $CLI bundle deploy

bundle/direct/dresources/cluster.go

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

122122
func (r *ResourceCluster) ClassifyChange(change structdiff.Change, remoteState *compute.ClusterDetails, _ bool) (deployplan.ActionType, error) {
123+
changedPath := change.Path.String()
124+
if changedPath == "data_security_mode" {
125+
if change.Old == compute.DataSecurityModeDataSecurityModeStandard && change.New == compute.DataSecurityModeUserIsolation {
126+
return deployplan.ActionTypeSkip, nil
127+
}
128+
if change.Old == compute.DataSecurityModeDataSecurityModeDedicated && change.New == compute.DataSecurityModeSingleUser {
129+
return deployplan.ActionTypeSkip, nil
130+
}
131+
if change.Old == compute.DataSecurityModeDataSecurityModeAuto && (change.New == compute.DataSecurityModeSingleUser || change.New == compute.DataSecurityModeUserIsolation) {
132+
return deployplan.ActionTypeSkip, nil
133+
}
134+
}
135+
123136
// Always update if the cluster is not running.
124137
if remoteState.State != compute.StateRunning {
125138
return deployplan.ActionTypeUpdate, nil
126139
}
127140

128-
changedPath := change.Path.String()
129141
if changedPath == "num_workers" || strings.HasPrefix(changedPath, "autoscale") {
130142
return deployplan.ActionTypeResize, nil
131143
}

0 commit comments

Comments
 (0)