cpln delete

Overview

The CLI delete command serves as the opposite of the CLI apply command. While the apply command creates and updates resources, the delete command deletes resources. Both the apply and the delete commands accept the same options.

Using the CLI

copy
cpln delete --file FILE_NAME [OPTIONS]

The FILE_NAME is the path for the file and it can be either a JSON or YAML file containing the resource metadata.

To delete an Identity, a Volume Set or a Workload resource you need to specify a GVC in one of the following methods.

  • Specify a gvc within your cpln profile. This will add the gvc to the session context of the profile and will be refered to as the default gvc when executing any future command including the cpln delete command.

    copy
    cpln profile update PROFILE_NAME --gvc GVC_NAME
  • Specify a --gvc flag to the delete command. This will pass the gvc as an option and will override the default gvc that is defined in the session context of the profile.

    copy
    cpln delete --file FILE_NAME --gvc GVC_NAME
  • Specify a gvc property in the resource definition in the file you wish to run the delete command against.

    copy
    kind: identity
    name: example-identity
    description: example-description
    tags: {}
    gvc: example-gvc
NOTE
You can either specify a gvc property or a --gvc flag, you can't specify both.

Click here to view the CLI reference page for the delete command.

Delete an Applied K8s File

The CLI has the ability to convert K8s resources into Control Plane resources. By passing the --k8s true option to the delete command, the K8s resources will be converted and deleted.

copy
cpln delete --file FILE_NAME --k8s true

The delete command will use the logic of the CLI convert command and then delete the resources defined in the output.

Delete from Standard Input

In case you would like to pass Control Plane resources through stdin (Standard Input) and delete them, use the following command.

copy
CONTROL_PLANE_RESOURCES | cpln delete --file -
TIP
This is useful if you would like to pass the stdout of a command to the cpln delete command.

Using the Console

The console has the ability to upload a JSON or YAML file or accept a resource definition in JSON or YAML as input. The functionality is the same as using the CLI. Click the cpln apply button in the upper right corner of the console. A modal will be displayed containing the upload instructions. Enable the Use as Delete switch in order to delete a resource.

The cpln apply modal provides the ability to specify in which org and gvc a resource will be deleted. The default is your currently selected org and gvc.

A file or an input containing an Identity, a Volume Set or a Workload resource will be deleted in the scope of the specified gvc in the cpln apply modal. In case a gvc is defined within a resource, the resource will be deleted in the scope of that gvc.

Multiple Resources

To delete multiple resources, specify a JSON array or YAML's separated with ---.

copy
kind: gvc
name: example-gvc
description: example-gvc
tags: {}
spec:
staticPlacement:
locationLinks:
- /org/ORG_NAME/location/aws-eu-central-1
---
kind: identity
name: example-identity
description: example-identity
tags: {}
gvc: example-gvc
Copyright © 2024 Control Plane Corporation. All rights reserved. Revision 971d27e5
Contents