IBM Cloud Docs
Destroying workspace resources

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

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

  1. Log in to IBM Cloud.
  2. Access Schematics > Workspaces > workspace.
    • 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 icon. 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.

Verifying a workspace destroy operation

  1. Click your workspace that is listed in the IBM Cloud console to view the results of the destroy operation.
  2. Click Jobs tab to see the workspace logs.
  3. 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

  1. 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}

  2. Verify that your source created through workspace is destroyed.

    ibmcloud schematics workspace list
    
  3. 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

  1. Follow the steps to retrieve your IAM access token and authenticate with IBM Cloud Schematics by using the API.

  2. 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.0"
          ],
          "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.0",
             "variablestore":[
                {
                   "name":"sample_var",
                   "secure":true,
                   "value":"THIS IS IBM CLOUD TERRAFORM CLI DEMO",
                   "description":"Description of sample_var"
                },
                {
                   "name":"sleepy_time",
                   "value":"15"
                   }
                ]
             }
          ]
       }
    
  3. 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

  1. Follow the steps in Deleting Schematics data to destroy your workspace with Terraform.

  2. 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.