To effectively remove an unwanted workspace from an Organization in Terraform Cloud or Terraform Enterprise.
NOTE: Deleting a workspace is unrecoverable and any variables, settings, alert history, run history, and state related to it will be removed. This will not remove any infrastructure managed by this workspace. If needed, destroy the infrastructure prior to deleting the workspace.
- Manage Workspaces permissions at a minimum is required within the Organization
There are two methods that can be utilized to delete a workspace, using the UI or use of the API.
From the UI:
- Login to the Terraform Cloud <https://app.terraform.io/app/> or Terraform Enterpise <https://$The-TFE-URL/app> UI.
- Choose the Organization from where the workspace is to be deleted.
- Select the workspace that will be removed.
- While working within the workspace, locate the workspace Settings dropdown and click Destruction and Deletion.
- Follow and assess all of the instructions on this page to proceed with deleting a workspace.
Using the API:
- Engage this API link for instructions to delete a workspace.
- Here's a sample of the API delete request from the API doc:
$ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ --request DELETE \ https://app.terraform.io/api/v2/organizations/my-organization/workspaces/workspace-1
- You can then check within the Terraform Cloud or Terraform Enterpise UI to ensure the workspace has been removed or use the List workspace API to verify its existence. Here is a sample request to list the workspaces from an organization:
$ curl \ --header "Authorization: Bearer $TOKEN" \ --header "Content-Type: application/vnd.api+json" \ https://app.terraform.io/api/v2/organizations/my-organization/workspaces
- For additional assistance please contact HashiCorp Support to request additional assistance.