Do not execute build on bundle destroy (#1882)

## Changes
There's no value in building artifacts on destroy because they are just
removed from workspace as part of destroy.
This commit is contained in:
Andrew Nester 2024-11-07 10:31:49 +01:00 committed by GitHub
parent b6a376bf8a
commit 162aa212bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"github.com/databricks/cli/bundle"
"github.com/databricks/cli/bundle/config/mutator"
"github.com/databricks/cli/bundle/phases"
"github.com/databricks/cli/cmd/bundle/utils"
"github.com/databricks/cli/cmd/root"
@ -62,7 +63,12 @@ func newDestroyCommand() *cobra.Command {
diags = bundle.Apply(ctx, b, bundle.Seq(
phases.Initialize(),
phases.Build(),
// We need to resolve artifact variable (how we do it in build phase)
// because some of the to-be-destroyed resource might use this variable.
// Not resolving might lead to terraform "Reference to undeclared resource" error
mutator.ResolveVariableReferences(
"artifacts",
),
phases.Destroy(),
))
if err := diags.Error(); err != nil {