Deleting a Continuous Delivery service instance
You can delete resource group-based Continuous Delivery service instances.
To delete a Continuous Delivery service instance, you must have either the Administrator or Editor user permissions.
Deleting an instance of the Continuous Delivery service impacts your ability to use tool integrations within toolchains that are contained in the same region and resource group as the deleted service instance. For more information about this limitation, see Plan limitations and usage.
If you permanently delete an instance of Continuous Delivery in an enterprise account that has consolidated billing enabled, all Continuous Delivery service instances in the enterprise hierarchy will revert to reporting their individual authorized user counts independently. The total number of authorized users being billed in your enterprise account may increase as a result.
Deleting a Continuous Delivery service instance by using the console
- Log in to IBM Cloud.
- Go to the Resource list for your IBM Cloud account.
- In the Services section, locate the active Continuous Delivery service instance.
- From the Continuous Delivery service instance's Actions menu, click Delete.
- Click Delete to confirm that you want to delete the Continuous Delivery service.
Deleting a Continuous Delivery service instance from the CLI
-
Log in to IBM Cloud by using the IBM Cloud CLI.
ibmcloud login
If the login fails, run the
ibmcloud login --sso
command to try again. The--sso
parameter is required when you log in with a federated ID. If you use this option, go to the link that is listed in the CLI output to generate a one-time passcode. -
Optional. List all of the Continuous Delivery service instances in the targeted account to identify the instance that you want to delete.
ibmcloud resource service-instances --all-resource-groups --service-name continuous-delivery
-
Delete a service instance by running the
ibmcloud resource service-instance-delete
command.ibmcloud resource service-instance-delete SERVICE_NAME_OR_ID
The following table lists and describes each of the variables that are used in the previous steps.
Variable | Description |
---|---|
SERVICE_NAME_OR_ID |
The name or ID of the Continuous Delivery service instance that you want to delete. |
Deleting a Continuous Delivery service instance with the API
-
Obtain an IAM bearer token. Alternatively, if you are using an SDK, obtain an IAM API key and set the client options by using environment variables.
export RESOURCE_CONTROLLER_APIKEY={iam_api_key}
-
Delete the instance of the Continuous Delivery service instance that you want to remove.
curl -X DELETE \ https://resource-controller.cloud.ibm.com/v2/resource_instances/{instance_id} \ -H 'Authorization: Bearer {token}'
import com.ibm.cloud.platform_services.resource_controller.v2.ResourceController; import com.ibm.cloud.platform_services.resource_controller.v2.model.*; ... ResourceController resourceControllerService = ResourceController.newInstance(); DeleteResourceInstanceOptions deleteCdInstanceOptions = new DeleteResourceInstanceOptions.Builder() .id({instance_id}) .recursive(false) .build(); Response<Void> response = resourceControllerService.deleteResourceInstance(deleteCdInstanceOptions).execute();
const ResourceControllerV2 = require('@ibm-cloud/platform-services/resource-controller/v2'); const resourceControllerService = ResourceControllerV2.newInstance({}); ... (async() => { const params = { id: {instance_id}, recursive: false, }; await resourceControllerService.deleteResourceInstance(params); })();
from ibm_platform_services import ResourceControllerV2 ... resource_controller_service = ResourceControllerV2.new_instance() response = resource_controller_service.delete_resource_instance( id={instance_id}, recursive=False )
import { "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" } ... resourceControllerServiceOptions := &resourcecontrollerv2.ResourceControllerV2Options{} resourceControllerService, err := resourcecontrollerv2.NewResourceControllerV2UsingExternalConfig(resourceControllerServiceOptions) deleteCdInstanceOptions := resourceControllerService.NewDeleteResourceInstanceOptions( {instance_id}, ) deleteCdInstanceOptions.SetRecursive(false) response, err := resourceControllerService.DeleteResourceInstance(deleteCdInstanceOptions)
The following table lists and describes each of the variables that are used in the previous steps.
Variable | Description |
---|---|
{iam_api_key} |
Your IAM API key. |
{instance_id} |
The ID of the Continuous Delivery service instance that you want to delete. |
{token} |
A valid IAM bearer token. |
For more information about deleting service instances, see Deleting resource instances by using the API.
Deleting a Continuous Delivery service instance with Terraform
-
Locate the Terraform file (for example,
main.tf
) that contains theresource
block for the existing service instance. For more information about using Terraform with Continuous Delivery, see Creating a Continuous Delivery service instance with Terraform.The
resource
in the following example describes an existing Continuous Delivery service instance.data "ibm_resource_group" "group" { name = "default" } resource "ibm_resource_instance" "cd_service_instance" { name = "my CD service instance" service = "continuous-delivery" plan = "lite" location = "us-south" resource_group_id = data.ibm_resource_group.group.id }
-
Remove the
resource
block from your Terraform file. -
Initialize the Terraform CLI.
terraform init
-
Create a Terraform execution plan. This plan summarizes all of the actions that must be run to delete the Continuous Delivery service instance.
terraform plan
-
Apply the Terraform execution plan. Terraform takes all of the required actions to delete the Continuous Delivery service instance.
terraform apply
Restoring a deleted service instance
After you delete an instance of the Continuous Delivery service, you can restore the deleted service instance within the data retention period of seven days. After the seven-day period expires, the service instance is permanently deleted.
To view which service instances are available for restoration and to restore a deleted service, see Using resource reclamations. If you try to restore a deleted service and an active Continuous Delivery service instance exists, the restoration is blocked. For more information about how to view the details for a resource reclamation, see Listing reclaimed resources by using the CLI or Listing reclaimed resources by using the API.
You can have one active instance of Continuous Delivery only in a region and resource group. After you delete an instance of the Continuous Delivery service from a region and resource group, you can restore the deleted service instance to create
a service instance again within the data retention period of seven days. Alternatively, you can permanently remove the deleted service instance by using the ibmcloud resource reclamation-delete
command, and then create a Continuous Delivery service instance again.