# atmos terraform cache prune

Remove cached registry metadata older than the retention window. Immutable artifacts (provider zips, module archives) are kept unless you opt in with `--all`.

## Usage

```shell
atmos terraform cache prune [flags]
```

## Flags

- **`--older-than`** — Prune objects older than this Go duration (e.g. `168h`, `720h`). Defaults to `168h`.
- **`--all`** — Also prune immutable artifacts (provider zips, module archives), not just metadata.
- **`--dry-run`** — Show what would be pruned without deleting anything.

## Examples

```shell
# Prune metadata older than the default 168h window
atmos terraform cache prune

# Preview a more aggressive prune that also removes old artifacts
atmos terraform cache prune --older-than=720h --all --dry-run
```

## Related Commands

- [`atmos terraform cache stats`](/cli/commands/terraform/cache/stats)
- [`atmos terraform cache delete`](/cli/commands/terraform/cache/delete)
