Destruction and Deletion
Terraform Cloud workspaces have two primary delete actions:
- Destroying infrastructure deletes resources managed by the Terraform Cloud workspace by triggering a destroy run.
- Deleting a workspace deletes the workspace itself without triggering a destroy run.
In general, you should perform both actions in the above order when destroying a workspace to ensure resource cleanup for all of a workspace's managed infrastructure.
Destroy Infrastructure
Destroy plans delete the infrastructure managed by a workspace. We recommend destroying the infrastructure managed by a workspace before deleting the workspace itself. Otherwise, the unmanaged infrastructure resources will continue to exist but will become unmanaged, and you must go into your infrastructure providers to delete the resources manually.
Before queuing a destroy plan, enable the Allow destroy plans toggle setting on this page.
Automatically Destroy
Automated destroy runs are available as part of the ephemeral workspaces feature.
Some use cases may benefit from allowing Terraform Cloud to schedule future infrastructure deletion automatically. For example, you can automatically destroy a workspace's resources used solely in a development environment after a certain period of time to save on cost.
You can automatically schedule Terraform Cloud to run a destroy at a specific future date and time.
This setting is automatically unset whenever Terraform Cloud performs a destroy run. You can re-enable it to schedule another future destroy run.
Note: Unlike other runs, automatic destroy plans do not prompt you for apply approval in the Terraform Cloud user interface. We recommend only using this setting for development environments.
Delete Workspace
Terraform does not automatically destroy managed infrastructure when you delete a workspace.
After you delete the workspace and its state file, Terraform can no longer track or manage that infrastructure. You must manually delete or import any remaining resources into another Terraform workspace.
By default, workspace administrators can only delete unlocked workspaces that are not managing any infrastructure. Organization owners can force delete a workspace to override these protections. Organization owners can also configure the organization's settings to let workspace administrators force delete their own workspaces.