Skip to main content
The cpln delete command removes resources defined in YAML or JSON files, the inverse of cpln apply. Use the same manifest files to both create and tear down infrastructure.

When to use this

Tear down environments

Remove entire environments using the same manifests that created them

GitOps cleanup

Delete resources tracked in version control

Remove K8s conversions

Delete resources originally created from Kubernetes manifests

Batch deletion

Remove multiple related resources in one command

Basic usage

cpln delete --file <manifest.yaml>
This deletes all resources defined in the file.

Options

OptionDescription
--filePath to JSON/YAML file. Use --file - for stdin
--gvcGVC for scoped resources (workloads, identities, volumesets)
--k8sConvert K8s manifest before deleting (true/false)

Specify the GVC

Workloads, identities, and volumesets are scoped to a GVC. Specify it using one of these methods:
Pass the GVC with each command:
cpln delete --file workload.yaml --gvc my-gvc
You can either specify the GVC in the manifest or via --gvc, but not both.

Delete Kubernetes conversions

Delete resources that were originally applied from Kubernetes manifests:
cpln delete --file k8s-deployment.yaml --k8s true
This converts the K8s manifest to Control Plane format, then deletes the corresponding resources.

Delete from stdin

Pipe resources from another command:
# Delete resources from a converted K8s manifest
cpln convert --file k8s.yaml | cpln delete --file -

# Delete resources from a remote file
curl -s https://example.com/resources.yaml | cpln delete --file -

Multiple resources

Delete multiple resources from a single file using YAML document separators (---):
resources.yaml
kind: workload
name: my-app
gvc: production
spec:
  type: serverless
  containers:
    - name: main
      image: nginx:latest
---
kind: identity
name: my-identity
gvc: production
---
kind: secret
name: my-secret
type: opaque
cpln delete --file resources.yaml

Using the console

Delete resources via the console:
  1. Click cpln apply in the upper right corner
  2. Enable the Use as Delete switch
  3. Upload or paste your manifest
  4. Select the target org and GVC
  5. Click Delete

Common workflows

Tear down a complete environment

# Delete all resources in an environment manifest
cpln delete --file production-env.yaml

Remove a feature branch environment

# Clean up after merging
cpln delete --file feature-branch.yaml --gvc feature-123

Troubleshooting

The resource may have already been deleted or never existed. This is not an error - the command is idempotent.
For workloads, identities, and volumesets, specify the GVC:
cpln delete --file workload.yaml --gvc my-gvc
Some resources can’t be deleted if other resources depend on them. Delete dependent resources first, or delete the GVC containing all resources.

Next steps