IBM Cloud Docs
Deleting a routing table

Deleting a routing table

You can delete a routing table for an IBM Cloud service by using the console, CLI, API, or Terraform.

Deleting a routing table in the console

To delete a routing table in the IBM Cloud console, follow these steps:

  1. From the IBM Cloud console, select the Navigation Menu Navigation Menu icon, then click Infrastructure VPC icon > Network > Routing tables. The routing tables for VPC page appear.

  2. Click the Actions menu Actions menu next to the routing table that you want to delete, then click Delete. Click Delete again to confirm the deletion. Alternatively, you can click Actions > Delete from the routing table details page.

    You can delete a routing table only when it does not have any attached subnets and is not the default for its VPC. If the routing table that you want to delete is attached to a subnet, you can detach it by either reassigning the routing table to another subnet or by deleting the subnet. To reassign the subnet, go to the details page of the routing table, click the Subnets tab, and use the Actions menu Actions menu to reassign the subnet to another routing table. To delete the subnet, go to the list of subnets, and click the Actions menu Actions menu, and select Delete.

Deleting a routing table from the CLI

Before you begin, set up your CLI environment.

To delete a routing table from the CLI, run the following command:

ibmcloud is vpc-routing-table-delete VPC ROUTING_TABLE [-f, --force]

Where:

VPC
Is the ID of the VPC.
ROUTING_TABLE
Is the ID of the VPC routing table.
-f, --force
Forces the operation without confirmation.

Deleting a routing table with the API

To delete a routing table with the API, follow these steps:

  1. Set up your API environment.

  2. Store the following values in variables to be used in the API command:

    export VpcId=<your_vpc_id>
    export RoutingTableId=<your_routing_table_id>
    
  3. Delete a routing table:

    curl -X DELETE "$vpc_api_endpoint/v1/vpcs/$VpcId/routing_tables/$RoutingTableId?version=$api_version&generation=2" \
      -H "Authorization: $iam_token"
    

Deleting a routing table with Terraform

To delete a routing table with Terraform, follow these steps:

  1. Set up your Terraform environment.

  2. Delete a routing table:

    terraform destroy --target="ibm_is_vpc_routing_table.example"
    

    For more information about the terraform destroy command, see the Terraform Registry.