Destroying workspace resources
Remove the IBM Cloud® resources that you provisioned with your Schematics workspace, even if these resources are active.
IBM Cloud Schematics deprecates older version of Terraform. For more information, see Deprecating older version of Terraform process in IBM Cloud Schematics.
IBM Cloud Schematics deprecates creation of workspace using the IBM Cloud Provider Plug-in for Terraform v1.2, v1.3 template from 2nd week of April 2024.
Before you begin
- Create a Terraform configuration, and store the configuration in a
GitHub
,GitLab
, orBitbucket
repository. You can also upload a tape archive file (.tar
) from your local workstation to provide your template to IBM Cloud Schematics. For more information, see theibmcloud schematics workspace upload
command and see the upload atar
file to your workspace API. - Make sure that you have the permissions to create a workspace.
Ensure the location
and the url
endpoint are pointing to the same region when you create or update the Schematics workspace or action. For more information about location and endpoint, see Where is your information stored?
Destroying workspace resources using the UI
- Log in to IBM Cloud console.
- Click the Menu icon > Platform Automation > Schematics > Terraform.
- In workspace List section:
- Click required Workspace to destroy a required workspace. If you do not see the required workspace in the list, check your navigation page.
- Click
Next
.
- In Workspace list section. Click workspace name and click Actions dropdown. Click
Destroy resources
and enter workspace name for confirmation before delete. Enter the name while creation and click destroy. - Click
Destroy
. Your resource of workspace are destroyed.
- In workspace List section:
Verifying a workspace destroy operation
- Click your workspace that is listed in the IBM Cloud console to view the results of the destroy operation.
- Click Jobs tab to see the workspace logs.
- Click Jobs history tab view the result of the destroy job and operations that were run by the automation modules.
Destroying workspace resources using the CLI
-
Destroy workspace configuration. For more information about destroy the resource in workspace, see the
ibmcloud schematics destroy workspace
command.ibmcloud schematics destroy workspace --id <WORKSPACE_ID>
ibmcloud schematics destroy --id WORKSPACE_ID [--target RESOURCE1] [--target RESOURCE2] [--force] [--output OUTPUT]
{ pre}
-
Verify that your source created through workspace is destroyed.
ibmcloud schematics workspace list
-
Refer to, Managing IBM Cloud resources with Schematics to start Deleting, updating, or deleting IBM Cloud resources with Terraform.
Verifying a workspace destroy operation
Verify that the workspace was created successfully. When you destroy the resource by using the CLI, the command removes the resources of the workspace.
ibmcloud schematics destroy --id us-east.workspace.testwspace03jan.811182d2 --target vpc_name --target vpc_tags
Do you really want to perform this action? [y/N]> y
Activity ID c10fc92ddfd2d9ec645fc5dbece5e341
OK
On successful destroying, it returns the unique Activity ID of the workspace.
For more information, see workspace FAQs.
Destroying workspace resources using the API
-
Follow the steps to retrieve your IAM access token and authenticate with IBM Cloud Schematics by using the API.
-
Destroy the workspace.
Example:
PUT /v1/workspaces/{w_id}/destroy HTTP/1.1 Host: schematics.cloud.ibm.com Content-Type: application/json Authorization: <auth_token> { "name":"testwspace03jan", "type":[ "terraform_v1.4" ], "description":"terraform workspace", "location":"us-east", "tags":[ "department:HR", "application:compensation", "environment:production" ], "template_repo":{ "url":"https://github.com/Anil-CM/newrepo" }, "workspace_status":{ "frozen":true }, "template_data":[ { "folder":".", "type":"terraform_v1.4", "variablestore":[ { "name":"sample_var", "secure":true, "value":"THIS IS IBM CLOUD TERRAFORM CLI DEMO", "description":"Description of sample_var" }, { "name":"sleepy_time", "value":"15" } ] } ] }
-
See Managing IBM Cloud resources with Schematics to start Deleting, updating, or deleting IBM Cloud resources with Terraform.
Verifying a workspace destroy operation
Verify that the resource is destroyed successfully.
Verify that the workspace resource is destroyed successfully as shown in the output.
Output
{
"activityid": "6e5c84b58100472395b53a056cc27edc"
}
On successful, destroy the unique activity ID of the workspace is returned.
For more information, see workspace FAQs.
destroying workspace resources with Terraform
-
Follow the steps in Deleting Schematics data to destroy your workspace with Terraform.
-
See Managing IBM Cloud resources with Schematics to create, update, or delete the IBM Cloud resources.
Next steps
- Looking for additional workspace samples to work with? Check out the sample workspaces. Check the
Readme
files of the examples for further customization and usage.