mirror of https://github.com/databricks/cli.git
Compare commits
No commits in common. "fd67acbc7f88895bd3c8a81ce189a8bc953bb7f0" and "12259b9837e9ef933755dcb2817540e5b8df19a6" have entirely different histories.
fd67acbc7f
...
12259b9837
|
@ -51,43 +51,6 @@ func parseTerraformActions(changes []*tfjson.ResourceChange, toInclude func(typ
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
func showDryRunChanges(ctx context.Context, plan *tfjson.Plan) {
|
|
||||||
updateActions := make([]terraformlib.Action, 0)
|
|
||||||
for _, rc := range plan.ResourceChanges {
|
|
||||||
if rc.Change.Actions.Update() {
|
|
||||||
updateActions = append(updateActions, terraformlib.Action{
|
|
||||||
Action: terraformlib.ActionTypeUpdate,
|
|
||||||
ResourceType: rc.Type,
|
|
||||||
ResourceName: rc.Name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
createActions := make([]terraformlib.Action, 0)
|
|
||||||
for _, rc := range plan.ResourceChanges {
|
|
||||||
if rc.Change.Actions.Create() {
|
|
||||||
createActions = append(createActions, terraformlib.Action{
|
|
||||||
Action: terraformlib.ActionTypeCreate,
|
|
||||||
ResourceType: rc.Type,
|
|
||||||
ResourceName: rc.Name,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(updateActions) > 0 {
|
|
||||||
cmdio.LogString(ctx, "The following resources will be updated:")
|
|
||||||
for _, a := range updateActions {
|
|
||||||
cmdio.Log(ctx, a)
|
|
||||||
}
|
|
||||||
cmdio.LogString(ctx, "")
|
|
||||||
}
|
|
||||||
if len(createActions) > 0 {
|
|
||||||
cmdio.LogString(ctx, "The following resources will be created:")
|
|
||||||
for _, a := range createActions {
|
|
||||||
cmdio.Log(ctx, a)
|
|
||||||
}
|
|
||||||
cmdio.LogString(ctx, "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func approvalForDeploy(ctx context.Context, b *bundle.Bundle) (bool, error) {
|
func approvalForDeploy(ctx context.Context, b *bundle.Bundle) (bool, error) {
|
||||||
tf := b.Terraform
|
tf := b.Terraform
|
||||||
if tf == nil {
|
if tf == nil {
|
||||||
|
@ -100,11 +63,6 @@ func approvalForDeploy(ctx context.Context, b *bundle.Bundle) (bool, error) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.DryRun {
|
|
||||||
showDryRunChanges(ctx, plan)
|
|
||||||
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" {
|
||||||
|
@ -157,6 +115,15 @@ 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