Deleting a tenant from IBM Cloud Logs Routing
You can delete a tenant in IBM Cloud Logs Routing through the UI, by using the API, or programmatically by using Terraform.
A tenant is the account-specific configuration of IBM Cloud Logs Routing running within a region. The tenant configuration includes a maximum of 2 target definitions. The target defines where the logs are routed.
Before you begin
Complete the following steps:
-
Review About IBM® Cloud Logs Routing to understand concepts.
-
Install all prerequisite tools as described in the getting started.
-
Set up permissions to manage targets in the account. For more information, see Setting up IAM permissions for managing tenants.
-
To get details on a tenant by using the API, check that you can connect to IBM Cloud Logs Routing by using the management API. For more information, see Connecting to IBM® Cloud Logs Routing.
-
Deleting a tenant requires the tenant ID. If you do not remember your tenant ID, see Retrieving tenant information in IBM Cloud Logs Routing.
Retrieving the IAM bearer token
You must get an IBM Cloud® Identity and Access Management (IAM) access token to authenticate your requests to the IBM® Cloud Logs Routing service. For more information, see Retrieving an access token.
For example, you can retrieve your IAM bearer token and export it as an environment variable by running the following CLI command:
export IAM_TOKEN=`ibmcloud iam oauth-tokens --output json | jq -r '.iam_token'`
Retrieving the tenant ID
To get the tenant ID, see Retrieving tenant information.
Choosing the management endpoint
A tenant is the account-specific configuration of IBM Cloud Logs Routing running within a region.
To get the details of a tenant in a region, you must use the management endpoint URL for the region where the tenant is configured.
You can use private or public endpoints.
For more information, see Management endpoint URLs.
Deleting a tenant by using the API
The management endpoint that you call to remove a tenant is only available by using VPE.
Run the following command to delete a tenant from the IBM Cloud Logs Routing service by using the private endpoint:
curl -X DELETE https://management.private.${REGION}.logs-router.cloud.ibm.com/v1/tenants/${TENANT_ID} \
-H "IBM-API-Version: API_VERSION_DATE" \
-H "Authorization: ${IAM_TOKEN}"
Run the following command to delete a tenant from the IBM Cloud Logs Routing service by using the public endpoint:
curl -X DELETE https://management.${REGION}.logs-router.cloud.ibm.com/v1/tenants/${TENANT_ID} \
-H "IBM-API-Version: API_VERSION_DATE" \
-H "Authorization: ${IAM_TOKEN}"
Where:
-
IAM_TOKEN
is the IAM token that you must use to authenticate the request. -
TENANT_ID
defines the ID of the tenant that you are removing which was returned when the service was created. -
REGION
defines the region where your tenant is located. -
API_VERSION_DATE
defines the current date to request the latest version of the API. The valid format isYYYY-MM-DD
. Any date up to the current date can be provided.
Deleting a tenant and their targets through the UI
In the IBM Cloud Logs Routing console, you can see if a target is configured for a region.
When you delete a target, you also delete the account tenant definition in the region. Therefore, if you have a tenant with 2 targets, and you delete a target in the UI, you will delete the 2 targets and the tenant.
To delete a target for a IBM Cloud Logs Routing tenant in a region, complete the following steps:
-
Click the Menu icon
> Observability.
-
Click Logging > Routing.
-
Click the
next to the region that you want to change.
-
Click Delete target.
-
Confirm to delete the target.
Deleting a tenant by using Terraform
To delete a tenant that is managed by Terraform regardless of what targets may be configured, run the following Terraform command.
- Run
terraform destroy
to delete a tenant and all its targets.