Summary
When running E2E tests against LocalStack, CloudFormation stack deletion fails with a template validation error, even for minimal stacks that don't have the referenced resource.
Error
An error occurred (ValidationError) when calling the DeleteStack operation:
Template format error: Unresolved resource dependencies [AggregatorDLQ] in the Resources block of the template
Root Cause
LocalStack appears to be caching or confusing templates. A minimal stack (DynamoDB table only, no aggregator) fails deletion with an error referencing AggregatorDLQ which only exists in full stacks with aggregator enabled.
Investigation
# List stack resources - shows only DynamoDB table (minimal stack)
aws cloudformation describe-stack-resources --stack-name zae-limiter-e2e_test_xxx
# But deletion fails with error about AggregatorDLQ
aws cloudformation delete-stack --stack-name zae-limiter-e2e_test_xxx
Workaround
The E2E test fixtures wrap delete_stack() in try/except to handle this gracefully:
try:
await limiter.delete_stack()
except Exception as e:
# LocalStack may have issues with stack deletion, log but don't fail
print(f"Warning: Stack cleanup failed: {e}")
Resources can be deleted directly as a workaround:
aws dynamodb delete-table --table-name e2e_test_xxx
Impact
- Test stacks accumulate in LocalStack during E2E test runs
- Not a blocker for testing (tests pass)
- Would not affect real AWS deployments
Notes
This may be related to LocalStack's CloudFormation implementation or template caching behavior. Consider reporting upstream to LocalStack if this persists.
Summary
When running E2E tests against LocalStack, CloudFormation stack deletion fails with a template validation error, even for minimal stacks that don't have the referenced resource.
Error
Root Cause
LocalStack appears to be caching or confusing templates. A minimal stack (DynamoDB table only, no aggregator) fails deletion with an error referencing
AggregatorDLQwhich only exists in full stacks with aggregator enabled.Investigation
Workaround
The E2E test fixtures wrap
delete_stack()in try/except to handle this gracefully:Resources can be deleted directly as a workaround:
Impact
Notes
This may be related to LocalStack's CloudFormation implementation or template caching behavior. Consider reporting upstream to LocalStack if this persists.