Skip to content

Using generic CI/CD tools for your IaC automation? πŸ€–βš™οΈ

Download the Build vs Buy Guide→

Deleting a StackΒ»

When you are ready to delete your stack, you can do so by navigating to the Stack deletion tab in your stack settings. You will get a choice to keep or delete any of the resources that this stack manages. To delete your stack, type the stack's name into the confirmation box and click on the delete button.

Deleting Resources Managed by a StackΒ»

Depending on the backend of your stack, there are different commands you can run as a task before deleting the stack.

Backend Command
Terraform terraform destroy -auto-approve
CloudFormation aws cloudformation delete-stack --stack-name <cloudformation-stack-name>
Pulumi pulumi destroy --non-interactive --yes
Kubernetes kubectl delete --ignore-not-found -l spacelift-stack=<stack-slug> $(kubectl api-resources --verbs=list,create -o name &#124; paste -s -d, -)

Tip

For Terraform, you can also run a task through our CLI tool spacectl.

Scheduled DeleteΒ»

If you would like to schedule to delete a stack, please see our documentation on Scheduling.

Using the APIΒ»

If you would like to delete a stack using our API, please see our documentation on GraphQL API.