IBM Cloud Docs
Deleting a virtual network interface

Deleting a virtual network interface

When you no longer need a virtual network interface, you can delete it by using the console, CLI, API, or Terraform. Make sure that no attachments remain in the virtual network interface before attempting to delete.

Deleting a virtual network interface in the console

To delete a virtual network interface, 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 > Virtual network interfaces.
  3. Click the name of the virtual network interface that you want to delete in the Virtual network interfaces for VPC table.
  4. Click the Actions menu on the Details page, and select Delete.
  5. Confirm that you want to delete this virtual network interface in the window that appears, or click Cancel.

Deleting one or more virtual network interfaces from the CLI

Before you begin, set up your CLI environment.

export IBMCLOUD_IS_FEATURE_VNI_PHASE_II=true

To delete one or more virtual network interfaces from the CLI, enter the following command:

ibmcloud is virtual-network-interface-delete (VIRTUAL_NETWORK_INTERFACE1 VIRTUAL_NETWORK_INTERFACE2 ...) [-f, --force] [-q, --quiet]

Where:

VIRTUAL_NETWORK_INTERFACE1
ID or name of the virtual network interface.
VIRTUAL_NETWORK_INTERFACE2
ID or name of the virtual network interface.
--force, -f
Forces the operation without confirmation.
-q, --quiet
Suppress verbose output.

Command examples

  • ibmcloud is virtual-network-interface-delete my-vni-share-99 cli-vni-demo-00
  • ibmcloud is virtual-network-interface-delete r006-866fc826-6f30-444f-b55e-0d697cf8b4bb

Deleting a virtual network interface with the API

To delete a virtual network interface 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.
    • virtual_network_interface_id (string): The virtual network interface identifier.
    curl -X DELETE \
    "$vpc_api_endpoint/v1/virtual_network_interfaces/$virtual_network_interface_id?version=$version&generation=2" \
    -H "Authorization: Bearer $iam_token"
    

Deleting a virtual network interface with Terraform

The following example deletes a virtual network interface by using Terraform:

terraform destroy --target ibm_is_virtual_network_interface.my_virtual_network_interface_instance