Skip to main content

atmos aws cloudformation source delete

Use this command to delete the vendored source directory for an aws/cloudformation component. This removes the component directory that was created by atmos aws cloudformation source pull.

Source-Based Version Pinning

Configure source locations, version pins, and authentication.

atmos aws cloudformation source delete --help=all
 

Usage​

atmos aws cloudformation source delete [component] [--stack <stack>] [--force]

Description​

The delete command removes the vendored component directory. Without --force, it prompts for confirmation and deletes only after you confirm. Use --force to skip the confirmation prompt.

The component and stack can be omitted to request interactive selection. Selection requires interactive mode, terminal input, and available candidates; it is disabled in CI. If either value remains unresolved, the command reports a missing-argument or missing-stack error. --force skips deletion confirmation only; it does not supply missing component or stack values.

For CI or other unattended use, provide the component, --stack, and --force. If the directory exists and terminal input is unavailable, running without --force returns an interactive-input error and leaves the directory unchanged.

This is useful for:

  • Cleaning up vendored components before re-vendoring
  • Removing components that are no longer needed
  • Resetting to a clean state for troubleshooting

Examples​

Delete Vendored Component​

Remove a vendored component directory without prompting:

atmos aws cloudformation source delete vpc --stack dev --force

Output:

Deleting directory: components/cloudformation/vpc
✓ Successfully deleted: components/cloudformation/vpc

Without Force Flag​

In an interactive terminal, omit --force to review and confirm the deletion:

atmos aws cloudformation source delete vpc --stack dev

The command asks whether to delete the source directory. Choose Yes! to delete it, or No. to cancel and keep the directory. Without terminal input, use --force as shown in the previous example.

Preview with --dry-run​

Use --dry-run to check the source directory and deletion guards without removing files:

atmos aws cloudformation source delete vpc --stack dev --dry-run

Request Interactive Selection​

Omitting the component and stack prompts you to select a source-managed CloudFormation component and a stack containing it, then confirm deletion:

atmos aws cloudformation source delete

You can also provide the component and omit --stack to select only the stack. If ATMOS_STACK is set, that stack is used without a selection prompt.

Arguments​

component
The name of the Atmos component to delete. May be omitted for interactive selection when a matching candidate is available; required explicitly for non-interactive use.

Flags​

--stack / -s
The Atmos stack name. Can also be set via ATMOS_STACK. If unset, attempts interactive selection of a stack containing the component. For non-interactive use, supply --stack or ATMOS_STACK.
--force / -f
Optional. Skip confirmation and delete the source directory. Use this flag for non-interactive deletion.
--dry-run
Validate static configuration and show the destination without authentication, downloads, or deletion.

Safety​

The command checks that the component has a source and that its resolved directory was provisioned by Atmos. A missing directory produces a warning.

  1. Confirmation by default - Prompts before deletion unless --force is set; declining preserves the directory
  2. Only deletes source-managed components - Only works on components with source configured
  3. Non-destructive on missing directories - Shows a warning if the directory doesn't exist instead of failing

Directory Selection​

Deletion uses the same destination as source pull, including the base component, working_directory, and workdir settings. A directory used by another local component in the same stack is protected from deletion.

Older Downloads​

Atmos records source ownership in .atmos/source.json, or .atmos/metadata.json for workdirs. Downloads made before these records were introduced cannot be deleted by this command. Run source pull --force to refresh the source and record ownership, or remove the directory manually.

See Also​