2023-04-06 10:54:58 +00:00
|
|
|
package phases
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/databricks/bricks/bundle"
|
|
|
|
"github.com/databricks/bricks/bundle/deploy/files"
|
|
|
|
"github.com/databricks/bricks/bundle/deploy/lock"
|
|
|
|
"github.com/databricks/bricks/bundle/deploy/terraform"
|
|
|
|
)
|
|
|
|
|
|
|
|
// The destroy phase deletes artifacts and resources.
|
|
|
|
func Destroy() bundle.Mutator {
|
|
|
|
return newPhase(
|
|
|
|
"destroy",
|
|
|
|
[]bundle.Mutator{
|
|
|
|
lock.Acquire(),
|
|
|
|
terraform.StatePull(),
|
2023-04-19 23:00:53 +00:00
|
|
|
terraform.Plan(terraform.PlanDestroy),
|
2023-04-19 13:14:26 +00:00
|
|
|
terraform.ShowPlan(),
|
2023-04-19 23:00:53 +00:00
|
|
|
terraform.Apply(terraform.ApplyDestroy),
|
2023-04-06 10:54:58 +00:00
|
|
|
terraform.StatePush(),
|
|
|
|
lock.Release(),
|
|
|
|
files.Delete(),
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|