IBM Cloud Docs
Creating a Continuous Delivery service instance

Creating a Continuous Delivery service instance

You must have an IBM Cloud® Continuous Delivery service instance before you can create and use toolchains that contain certain tool integrations. For more information about this limitation, see Scope of a service instance.

After you create a Continuous Delivery service instance, you can create continuous delivery toolchains.

You can have one active instance of Continuous Delivery only in a region and resource group. For information about deleting an existing service instance, see Deleting a Continuous Delivery service instance.

Creating a Continuous Delivery service instance by using the console

  1. Log in to IBM Cloud.
  2. From the IBM Cloud console, click Catalog and select Services.
  3. Select the Developer Tools category.
  4. Click the Continuous Delivery tile.
  5. Select the region that you want to create the Continuous Delivery service in.
  6. Choose a Lite or Professional pricing plan. Lite plans offer the full capabilities of Continuous Delivery to small teams at no cost, with usage limits. If you create a Lite-plan instance, it is automatically deleted 30 days after creation. For more information about Continuous Delivery service plans, see Plan limitations and usage.
  7. In the Configure your resource section, specify a name for the Continuous Delivery instance that you are creating.
  8. Select the resource group where you want to create the Continuous Delivery service instance. You cannot change the selected resource group after you create the Continuous Delivery service instance. For more information about how to organize resources in your IBM Cloud account, see Best practices for organizing resources in a resource group.
  9. Specify the tags that you want to use to organize and filter the resources in your resource list. You can also use these tags to identify team usage or cost allocation. These tags are visible account wide. For more information about using tags, see Working with tags.
  10. If you chose a Professional pricing plan, you can select the instance of the IBM® Key Protect for IBM Cloud® service or the instance of the IBM Cloud® Hyper Protect Crypto Services, and the root key that is used to encrypt your personal information. Make sure that the Key Protect instance or the Hyper Protect Crypto Services instance and the root key exist and the toolchain resources are authorized to access Key Protect or Hyper Protect Crypto Services in the Manage Authorizations section. Only private endpoints are currently supported for the Hyper Protect Crypto Services service instance. For more information about what types of data are encrypted, see Protecting your personal data when you use the Professional plan.
  11. Click Create.

Creating a Continuous Delivery service instance from the CLI

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

  2. Select the account, region, and resource group where you want to create a Continuous Delivery service instance.

    ibmcloud target -c ACCOUNT -r REGION -g RESOURCE_GROUP
    
  3. Create an instance of Continuous Delivery within the targeted account, region, and resource group.

    ibmcloud resource service-instance-create INSTANCE_NAME continuous-delivery PLAN REGION -p ENCRYPTION
    

The following table lists and describes each of the variables that are used in the previous steps.

Table 1. Variables for provisioning the Continuous Delivery service from the CLI
Variable Description
ACCOUNT The name or ID of the account in which to provision the service instance. To find the names and IDs of the available accounts, run ibmcloud account list.
ENCRYPTION Optional. To provision your service instance to use customer-managed encryption, append -p '{"kms_info": {"id": <kms_instance_id>, "url": <kms_url>}, "kms_key": {"id": <kms_root_key_id>, "crn": <kms_transaction_crn>}}.
INSTANCE_NAME The name for your service instance.
PLAN The name or ID of the pricing plan that you want to use. To find the names and IDs of the available plans, run ibmcloud catalog service continuous-delivery.
REGION The region in which to provision the service instance. For example, us-south.
RESOURCE_GROUP The name or ID of the resource group in which to provision the service instance. To find the names and IDs of the available resource groups, run ibmcloud resource groups.

For more information about plan IDs or about how to update your service plan after you create an instance, see Updating your service plan.

Creating a Continuous Delivery service instance with the API

  1. 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}
    
  2. Look up the ID of the resource group in which you want to create your instance.

  3. Choose the region in which you want to create your instance.

  4. Look up the ID of the service plan of the instance that you want to create.

  5. Create an instance of Continuous Delivery within the targeted account, region, and resource group.

    curl -X POST \
      https://resource-controller.cloud.ibm.com/v2/resource_instances \
      -H 'Authorization: Bearer {token}' \
      -H 'Content-Type: application/json' \
        -d '{
        "name": "{instance_name}",
        "target": "{region}",
        "resource_group": "{resource_group_id}",
        "resource_plan_id": "{plan_id}"
        "parameters": "{parameters}"
      }'
    
    import com.ibm.cloud.platform_services.resource_controller.v2.ResourceController;
    import com.ibm.cloud.platform_services.resource_controller.v2.model.*;
    ...
    ResourceController resourceControllerService = ResourceController.newInstance();
    CreateResourceInstanceOptions createCdInstanceOptions = new CreateResourceInstanceOptions.Builder()
       .name({instance_name})
       .target({region})
       .resourceGroup({resource_group_id})
       .resourcePlanId({plan_id})
       .build();
    Response<ResourceInstance> response = resourceControllerService.createResourceInstance(createCdInstanceOptions).execute();
    ResourceInstance cdInstance = response.getResult();
    
    const ResourceControllerV2 = require('@ibm-cloud/platform-services/resource-controller/v2');
    const resourceControllerService = ResourceControllerV2.newInstance({});
    ...
    (async () => {
       const params = {
          name: {instance_name},
          target: {region},
          resourceGroup: {resource_group_id},
          resourcePlanId: {plan_id},
       };
       const res = await resourceControllerService.createResourceInstance(params);
       const cdInstanceGuid = res.result.guid;
    })();
    
    from ibm_platform_services import ResourceControllerV2
    ...
    resource_controller_service = ResourceControllerV2.new_instance()
    cd_instance = resource_controller_service.create_resource_instance(
       name={instance_name},
       target={region},
       resource_group={resource_group_id},
       resource_plan_id={plan_id}
    ).get_result()
    
    import {
       "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2"
    }
    ...
    resourceControllerServiceOptions := &resourcecontrollerv2.ResourceControllerV2Options{}
    resourceControllerService, err := resourcecontrollerv2.NewResourceControllerV2UsingExternalConfig(resourceControllerServiceOptions)
    createCdInstanceOptions := resourceControllerService.NewCreateResourceInstanceOptions(
       {instance_name},
       {region},
       {resource_group_id},
       {plan_id},
    )
    cdInstance, response, err := resourceControllerService.CreateResourceInstance(createCdInstanceOptions)
    

The following table lists and describes each of the variables that are used in the previous steps.

Table 2. Variables for provisioning the Continuous Delivery service with the API
Variable Description
{iam_api_key} Your IAM API key.
{instance_name} A name for your service instance.
{parameters} To provision your service instance to use customer-managed encryption, pass the following parameters: '{"kms_info": {"id": <kms_instance_id>, "url": <kms_url>}, "kms_key": {"id": <kms_root_key_id>, "crn": <kms_transaction_crn>}}.
{plan_id} The ID of the pricing plan that you want to use.
{region} The region in which to provision the service instance. For example, us-south.
{resource_group_id} The ID of the resource group in which to provision the service instance. To find the IDs of the available resource groups, run ibmcloud resource groups.
{token} A valid IAM bearer token.

For more information about creating service instances, see Creating new resource instances by using the API.

Creating a Continuous Delivery service instance with Terraform

  1. To install the Terraform CLI and configure the IBM Cloud provider plug-in for Terraform, follow the tutorial for Getting started with Terraform on IBM Cloud.

  2. Create a Terraform configuration file that is named main.tf. In this file, add the configuration to create resource instances by using the HashiCorp Configuration Language. For more information about using this configuration language, see the Terraform documentation.

    The following example creates a Continuous Delivery service instance by using the ibm_resource_instance resource, where name is a unique, descriptive name that identifies the resource 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
    }
    

    For more information about ibm_resource_instance, see the argument reference details in the Terraform Registry Documentation.

    To provision your service instance to use customer-managed encryption, add and populate the parameters attribute with your key management service instance ID and root key ID.

      parameters = {
        kms_instance = <kms_instance_id>
        kms_key = <kms_key>
      }
    
  3. Initialize the Terraform CLI.

    terraform init
    
  4. Create a Terraform execution plan. This plan summarizes all of the actions that must be run to create a Continuous Delivery service instance.

    terraform plan
    
  5. Apply the Terraform execution plan. Terraform takes all of the required actions to create the Continuous Delivery service instance.

    terraform apply