mirror of https://github.com/databricks/cli.git
Move dry run check before possible reutrns
This commit is contained in:
parent
12259b9837
commit
9e53f117d2
|
@ -63,6 +63,15 @@ func approvalForDeploy(ctx context.Context, b *bundle.Bundle) (bool, error) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b.DryRun {
|
||||||
|
cmdio.LogString(ctx, "Following changes would be deployed:")
|
||||||
|
_, err := tf.ShowPlanFile(ctx, b.Plan.Path)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
schemaActions := parseTerraformActions(plan.ResourceChanges, func(typ string, actions tfjson.Actions) bool {
|
schemaActions := parseTerraformActions(plan.ResourceChanges, func(typ string, actions tfjson.Actions) bool {
|
||||||
// Filter in only UC schema resources.
|
// Filter in only UC schema resources.
|
||||||
if typ != "databricks_schema" {
|
if typ != "databricks_schema" {
|
||||||
|
@ -115,15 +124,6 @@ properties such as the 'catalog' or 'storage' are changed:`
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.DryRun {
|
|
||||||
cmdio.LogString(ctx, "Following changes would be deployed:")
|
|
||||||
_, err := tf.ShowPlanFile(ctx, b.Plan.Path)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if !cmdio.IsPromptSupported(ctx) {
|
if !cmdio.IsPromptSupported(ctx) {
|
||||||
return false, fmt.Errorf("the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed")
|
return false, fmt.Errorf("the deployment requires destructive actions, but current console does not support prompting. Please specify --auto-approve if you would like to skip prompts and proceed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue