# Add cleanup job to remove everything that have been created on your cloud provider by Terraform
The final step is the time to clean up what we built previously.
To remove all things created by Terraform, we will create a
destroy job which calls a terraform destroy (opens new window) command.
Follow those steps to apply all changes described in this step
groups: - name: all jobs: ... - name: destroy jobs: - terraform-destroy jobs: ... - name: terraform-destroy max_in_flight: 1 build_logs_to_retain: 10 plan: - do: - get: git_stack trigger: false - get: git_config trigger: false - *task-merge-stack-and-config - put: tfstate params: action: destroy terraform_source: merged-stack/ get_params: action: destroy
As you are familiar enough, create a new job that gets our Git, merge parts, get the tfstate file to know the current state of what Terraform has created, then call terraform resource to destroy it.
The only specificity is that we created a dedicated group for this job called
destroy in order to have it into a dedicated section of our pipeline view.
Add and commit those changes in Git:
git add . git commit -m "Step 9" git push origin stacks
Get back to Cycloid's dashboard, and click on the
Refresh pipeline button .
Call this new job and that's it, all cleaned up!
You did it! Well done. Now is the time to review our Advanced Guide.
# Key points to remember
- To remove all things created by Terraform, we create a
destroyjob which calls the terraform destroy (opens new window) command