IBM Cloud Docs
Deleting a connection

Deleting a connection

Deleting a connection in the UI

To delete a connection from a 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 Interconnectivity > Transit Gateway.

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

    If you are in the expanded view, click View details.

  4. From the Connections page, click the Actions menu Actions menu next to the connection that you want to delete and select Delete.

Deleting a connection from the CLI

You can delete an existing connection with the CLI with the following command:

ibmcloud tg connection-delete|cd GATEWAY_ID CONNECTION_ID [-f, --force] [-h, --help]

Where:

  • GATEWAY_ID: ID of the gateway of the connection being deleted.

  • CONNECTION_ID: ID of the connection being deleted.

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

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

Example

This example illustrates deleting a connection without confirmation:

ibmcloud tg cd $gateway $connection -f

Deleting a connection with the API

You can delete a connection with the API.

After the specified connection is detached, entities still within the transit gateway will no longer be able to communicate directly to it through the IBM Cloud private backbone.

Example Request

This example request illustrates deleting a connection:

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

Example Response

This example illustrates the returned response when the connection could not be found:

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

For more information, see Removes a connection from Transit Gateway in the Transit Gateway API reference.

Deleting a connection using Terraform

To delete a connection, perform the following command:

terraform destroy -target=resource_type.resource_name

Where:

  • resource_type: ibm_tg_connection

  • resource_name: Name of connection

Example

This example illustrates deleting a connection using Terraform:

terraform destroy -target=ibm_tg_connection.test_ibm_tg_connection