CliFi

CLI Reference

clifi destroy

Tear down resources created by a CliFi workflow. Use with caution.

Synopsis

clifi destroy [target...] [flags]

Description

The destroy command reverses the effects of a deployment by executing the teardown tasks defined in your workflow. It is the inverse of clifi deploy and is designed to safely remove provisioned resources, containers, or cloud infrastructure.

By default, CliFi requires interactive confirmation before destroying resources in non-local environments. Pass --yes to skip confirmation in automated contexts.

The command reads the state file from the last successful deployment to determine which resources to destroy. If the state file is missing or corrupted, CliFi aborts with an error unless --force is passed.

Flags

FlagShorthandDefaultDescription
--env-elocalTarget environment
--yes-yfalseSkip confirmation prompts
--force-ffalseDestroy even if state file is missing
--dry-run-nfalsePreview what would be destroyed
--timeout300Timeout in seconds for teardown

Examples

Destroy with confirmation

bash
clifi destroy --env staging

Destroy without confirmation

bash
clifi destroy --env staging --yes

Preview destruction

bash
clifi destroy --env production --dry-run

Force destroy without state

bash
clifi destroy --env dev --force --yes

Safety guardrails

CliFi implements several safety mechanisms to prevent accidental destruction:

  • Confirmation prompts for all non-local environments
  • State file validation before teardown
  • Dependency-aware destruction order (reverse of deployment)
  • Graceful handling of partially destroyed resources
  • Audit logging of all destroy operations

See also