IBM Cloud Docs
Deleting a cluster network

Deleting a cluster network

You can delete a cluster network interface after all attached instances are deleted.

Before you begin

Make sure that a cluster network exists. For more information, see Creating a cluster network.

You can delete a cluster network with the console, CLI, API, or Terraform.

Deleting a cluster network in the console

To delete a cluster network in the IBM Cloud console, follow these steps:

  1. From your browser, open the IBM Cloud console and log in to your account.
  2. Select the Navigation menu Navigation menu icon, then click Infrastructure VPC icon > Network > Cluster networks.
  3. In the Cluster networks for VPC table, locate the cluster network interface that you want to delete, then click Delete in the Actions menu Actions menu.

Alternatively, you can Delete a cluster network from the Actions menu on the cluster network's details page.

Deleting a cluster network from the CLI

To delete a cluster network from the CLI, follow these steps:

  1. Set up your CLI environment.

  2. Log in to your account with the CLI. After you enter the password, the system prompts for the account and region:

    ibmcloud login --sso
    
  3. To delete one or more cluster networks, enter the following command:

    ibmcloud is cluster-network-delete (CLUSTER_NETWORK1 CLUSTER_NETWORK2...) [--output JSON]  [-f, --force] [-q, --quiet]
    

    Where:

    CLUSTER_NETWORK1 CLUSTER_NETWORK2
    IDs or names of the cluster networks, which are separated by a space.
    -output
    Specify the output format. Only JSON is supported. One of: JSON.
    -force, -f
    Force the operation without confirmation.
    -q, --quiet
    Suppress verbose output.

Command example

To delete the cluster network cli-cn-1. You are prompted for confirmation. This action can't be undone.

ibmcloud is cluster-network-delete cli-cn-1

Deleting a cluster network with the API

To delete a cluster network with the API, follow these steps:

  1. Set up your API environment with the right variables.

  2. Store any additional variables to be used in the API commands. For example:

    version (string): The API version, in format YYYY-MM-DD.

  3. When all variables are initiated, run the following command delete the cluster network:

    curl -X DELETE   "$vpc_api_endpoint/v1/cluster_networks/$cluster_network_id?version=$api_version&generation=2" -H "Authorization: Bearer $iam_token"
    

To view the complete set of cluster network APIs, see the VPC API reference.

Deleting a cluster network with Terraform

Use the terraform destroy command to delete a cluster network. The following example deletes ibm_is_cluster_network.

terraform destroy --target ibm_is_cluster_network

You can delete all resources that were created by using a .tf file. For example, if you created a cluster with the following .tf file (terraform apply -auto-approve), the command terraform destroy auto-approve deletes all resources that are defined in your .tf file.

// Provision is_cluster_network resource instance
resource "ibm_is_cluster_network" "is_cluster_network_instance" {
  name            = var.is_cluster_network_name  // change to update
  profile         = "h100"
  resource_group  = "fee82deba12e4c0fb69c3b09d1f12345"
  subnet_prefixes {
    cidr = "10.0.0.0/24"
  }
  vpc             = "r006-4727d842-f94f-4a2d-824a-9bc9b02c523b"
  zone            = "us-south-1"
}