IBM Cloud Docs
Deleting a transit gateway

Deleting a transit gateway

Deleting a transit gateway in the UI

To delete an IBM Cloud® Transit Gateway, follow these steps:

  1. From your browser, open the IBM Cloud console and log in to your account.

  2. Select the Navigation Menu icon Navigation Menu icon from the upper left, then click Infrastructure > Network > Transit Gateway.

  3. Click the name of the transit gateway you want to delete.

  4. Ensure the transit gateway has no attached connections - if it does, delete all connections. For each connection you want to delete, click the Actions menu next to it, then select Delete.

  5. After the connections are removed, you can delete the transit gateway in two ways:

    • From the transit gateway's details page, click the Actions menu Actions menu next to the gateway you want to delete and select Delete.
    • From an individual transit gateway page, select Actions > Delete.

Deleting a transit gateway from the CLI

To delete an existing gateway from the CLI, enter the following command:

ibmcloud tg gateway-delete|gwd GATEWAY_ID [-f, --force] [-h, --help]

Where:

  • GATEWAY_ID: ID of the gateway you want to delete.

  • --force | -f: Optional: Force the delete without confirmation.

  • --help | -h: Optional: Get help on this command.

Example

This example illustrates deleting a gateway with no confirmation:

ibmcloud tg gwd $gateway -f

Deleting a transit gateway with the API

To delete a transit gateway with the API, follow these steps:

  1. Remove all connections from the transit gateway.
  2. Request the deletion of the gateway with the API.

Example Request

This example iiilustrates a transit gateway deletion request:

curl -X DELETE "https://transit.cloud.ibm.com/v1/transit_gateways/$TRANSIT_GATEWAY_ID?version=2022-02-10" -H "accept: */*"

Example Response

This example illustrates that the transit gateway could not be found, leading to a Status 404 response:

{
  "errors": [
    {
      "code": "not_found",
      "message": "Cannot find Gateway",
      "more_info": "https://cloud.ibm.com/apidocs/transit-gateway#error-handling"
    }
  ],
  "trace": "request_id"
}

For more information, see Deletes specified Transit Gateway in the Transit Gateway API reference.

Deleting a transit gateway using Terraform

To delete a transit gateway, enter the following command:

terraform destroy -target=resource_type.resource_name

Where:

  • resource_type: ibm_tg_gateway

  • resource_name: Name of transit gateway

Example

This example illustrates deleting a transit gateway named "new_tg_gw":

terraform destroy -target=ibm_tg_gateway.new_tg_gw