cub unit destroy
cub unit destroy
Destroy configuration units from the target
Synopsis
Destroy configuration units from the target.
A target must be attached to the unit (cub unit set-target can be used to add one), and the worker corresponding to the target must be connected and ready (cub worker get can be used to get the worker status).
Examples:
# Destroy a single unit by slug
cub unit destroy my-unit
# Destroy multiple specific units
cub unit destroy --space my-space --unit unit1,unit2,unit3
cub unit destroy --space my-space --unit unit1 --unit unit2 --unit unit3
# Bulk destroy units using a WHERE clause with labels
cub unit destroy --space my-space --where "Labels.Tier = 'backend'"
# Destroy units with multiple label conditions
cub unit destroy --space my-space --where "Labels.App = 'api' AND Labels.Tier = 'backend'"
# Dry run to see what would be destroyed
cub unit destroy --space my-space --unit unit1,unit2 --dry-run
# Destroy all applied units in a space (use with caution!)
cub unit destroy --space my-space --where "LiveRevisionNum > 0"
# Destroy units across all spaces (requires --space "*")
cub unit destroy --space "*" --where "Space.Labels.Environment = 'test'"
cub unit destroy [<unit-slug>] [flags]
Options
--dry-run Perform a dry run without actually destroying
--filter string Filter entity to apply to the list. Specify as 'space/filter' for cross-space filters or just 'filter' for current space. Supports both slugs and UUIDs. The filter will be combined with any --where clause using AND logic. Examples: "production-filters/security-check", "my-filter-uuid", "validation-rules"
-h, --help help for destroy
--jq string jq expression, suppressing default output
--json JSON output, suppressing default output
--quiet No default output.
--timeout string completion timeout as a duration with units, such as 10s or 2m (default "10m0s")
--unit strings target specific units by slug or UUID (can be repeated or comma-separated)
--verbose Detailed output, additive with default output
--wait wait for completion
--where string Filter expression using SQL-inspired syntax. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. Examples: "Slug LIKE 'app-%'", "DisplayName ILIKE '%backend%'", "Slug ~ '^[a-z]+-[0-9]+$'"
--yaml YAML output, suppressing default output
--yq string yq expression, suppressing default output
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
--space string space ID to perform command on
SEE ALSO
- cub unit - Unit commands