Deleting public address ranges
You can delete public address ranges with the console, CLI, API, and Terraform.
Deleting public address ranges in the console
To delete public address ranges in the IBM Cloud console, follow these steps:
- From the IBM Cloud console, Select the Navigation menu
, then click Infrastructure
> Network > Public address ranges. The Public address ranges for VPC page appears.
- Highlight the row of the address range in the table, then click Delete from the Actions menu
.
- Click Delete to confirm that you want to delete this address range from the VPC.
Deleting public address ranges from the CLI
To delete public address ranges from the command line, follow these steps:
-
Log in to your CLI environments. After you enter the password, the system prompts which account and region that you want to use:
ibmcloud login --sso -
Enable the following feature flag:
export IBMCLOUD_IS_FEATURE_PUBLIC_ADDRESS_RANGE=trueYou'll receive a notification in the command line when updates to the IBM Cloud CLI and its plug-ins are available. It's important to keep your CLI up to date to access the latest commands. To check the current version of all installed plug-ins, run
ibmcloud plugin list. -
Run the following command:
ibmcloud is public-address-range-delete [PUBLIC_ADDRESS_RANGE1…, PUBLIC_ADDRESS_RANGE2…] [-f, --force][--output JSON] [-q, --quiet]Where:
PUBLIC_ADDRESS_RANGE- The ID or name of the public address range to delete.
-f, --force- Force the operation without confirmation.
--output- The output format, only JSON is supported. One of: JSON.
-q, --quiet- Suppress verbose output.
Command example
Delete the public address range $par-id:
ibmcloud is public-address-range-delete $par-id
Deleting public address ranges with the API
To delete a public address range with the API, follow these steps:
-
Set up your API environment.
-
Store the following values in variables to be used in the API command:
For example:
version(string): The API version, in formatYYYY-MM-DD. -
When all variables are initiated, you can delete a public address range from a specific VPC as follows:
curl -sX DELETE \ "$e/v1/public_address_ranges/$par-id?version=$dt&generation=2" \ -H "Authorization: Bearer $iam_token"
Deleting public address ranges with Terraform
To delete a specific public address range with Terraform, run the following command. Replace ibm_is_public_address_range.here with the resource name that you defined in your Terraform configuration:
terraform destroy --target ibm_is_public_address_range.here
To delete all resources that are defined in your .tf file:
terraform destroy -auto-approve