Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> [CLI] bundle plan
Plan: 0 to add, 0 to change, 0 to delete, 1 unchanged

>>> [CLI] bundle deploy
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/files...
Deploying resources...
Updating deployment state...
Deployment complete!

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
delete cluster test_cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ cleanup() {
}
trap cleanup EXIT

trace $CLI bundle deploy > out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1

trace $CLI bundle plan >> out.plan.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1

trace errcode $CLI bundle deploy >> out.$DATABRICKS_BUNDLE_ENGINE.txt 2>&1
trace $CLI bundle deploy
trace $CLI bundle plan
trace $CLI bundle deploy
18 changes: 16 additions & 2 deletions bundle/direct/dresources/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,27 @@ func (r *ResourceCluster) DoDelete(ctx context.Context, id string) error {
return r.client.Clusters.PermanentDeleteByClusterId(ctx, id)
}

func (r *ResourceCluster) ClassifyChange(change structdiff.Change, remoteState *compute.ClusterDetails, _ bool) (deployplan.ActionType, error) {
func (r *ResourceCluster) ClassifyChange(change structdiff.Change, remoteState *compute.ClusterDetails, isLocal bool) (deployplan.ActionType, error) {
changedPath := change.Path.String()
if changedPath == "data_security_mode" && !isLocal {
// We do change skip here in the same way TF provider does suppress diff if the alias is used.
// https://github.com/databricks/terraform-provider-databricks/blob/main/clusters/resource_cluster.go#L109-L117
if change.Old == compute.DataSecurityModeDataSecurityModeStandard && change.New == compute.DataSecurityModeUserIsolation {
return deployplan.ActionTypeSkip, nil
}
if change.Old == compute.DataSecurityModeDataSecurityModeDedicated && change.New == compute.DataSecurityModeSingleUser {
return deployplan.ActionTypeSkip, nil
}
if change.Old == compute.DataSecurityModeDataSecurityModeAuto && (change.New == compute.DataSecurityModeSingleUser || change.New == compute.DataSecurityModeUserIsolation) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's better to skip it than to remap these in RemapState. Separate question (follow up PR) - should we also return a reason in ClassifyChanges? So we can show reason="alias" next to action="skip" in the plan.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I don't have a preference on adding the reason

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate reason in the plan would be nice. Can be separate PR.

return deployplan.ActionTypeSkip, nil
}
}

// Always update if the cluster is not running.
if remoteState.State != compute.StateRunning {
return deployplan.ActionTypeUpdate, nil
}

changedPath := change.Path.String()
if changedPath == "num_workers" || strings.HasPrefix(changedPath, "autoscale") {
return deployplan.ActionTypeResize, nil
}
Expand Down