-
Notifications
You must be signed in to change notification settings - Fork 112
direct: Handle data_security_mode aliases for clusters #3839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6683d6b
9e08d30
f869a26
1e01f6f
bd987e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
|
|
@@ -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) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tbh I don't have a preference on adding the reason
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.