CLI: Add command to clear/reset deployment cache state
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Is there an existing issue for this?
- [x] I have searched the existing issues
## Is your proposal related to a problem?
When switching deployment targets (e.g., from ACA to AKS) or changing regions, the Aspire CLI reuses cached deployment state from `~/.aspire/deployments/`. This causes issues like:
- Stale Azure region persisting from a previous deployment (e.g., stuck on `eastus` when you want `swedencentral`)
- Old resource references bleeding into new deployment configurations
- Cached Bicep deployment IDs and outputs from a previous target type conflicting with the new one
The only workaround today is to manually find and delete the correct hash-named folder in `~/.aspire/deployments/` and clear `aspire-output/`, which requires knowing the internal storage format.
## Describe the solution you'd like
~~Add an `aspire deploy --reset` or `aspire deploy clear-cache` command (or similar)~~ `aspire deploy --clear-cache` already exists for the deployment-state reset part.
1. ~~Clears the cached deployment state for the current project~~
2. Optionally clears the generated `aspire-output/` directory
3. ~~Forces the next deploy to prompt fresh for subscription, region, resource group, etc.~~
Something like:
- ~~`aspire deploy --reset`~~
- ~~`aspire deploy clear-cache`~~
- `aspire deploy --clear-cache`
## Additional context
Found during #AspiriFridays stream while switching from `addAzureContainerAppEnvironment` to `addAzureKubernetesEnvironment`. The cached `eastus` region persisted even though we needed to deploy to a different region due to VM SKU quota limits. Had to manually delete `~/.aspire/deployments//production.json` to unstick it.
Contributor guide
Assessment
This issue has not been assessed yet.