SAM Doctor

ERROR REFERENCE

Export cannot change while another stack imports it

CloudFormation refused to change or remove an exported output because at least one other stack imports it with Fn::ImportValue. This is a dependency safeguard, not a failure in the exporting stack.

WHAT IT MEANS

What this error means

Cross-stack exports form a contract: consumers pin the export's name and value until they stop importing it. Any update that would change the exported value — renaming the output, changing the resource it points at, deleting the exporting stack — is blocked with Export <name> cannot be updated as it is in use by <stack> for as long as one consumer remains.

The blocked deploy is doing its job. The consumers listed in the error (and any it did not list) would break the moment the export changed under them.

FIX

How to fix it

  1. List every consumer and record which stacks pin the export:
    aws cloudformation list-imports --export-name YOUR_EXPORT_NAME
  2. Migrate in stages: add a new export alongside the old one, update each consumer stack to import the new name, then remove the old export once list-imports shows no consumers.
  3. Do not delete or force-update the consumer stacks as a shortcut. They are load-bearing for whoever owns them — coordinate the migration with those owners instead.

AUTOMATE THE TRIAGE

Diagnose this automatically

SAM Doctor recognizes the in-use export refusal (high confidence) and keeps it distinct from generic DELETE_FAILED findings, with the staged-migration path in the guidance. Runs locally; no AWS access, no log upload.

python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown

RELATED