Deleting or updating a stack fails: `Export network-VpcId cannot be deleted as it is in use by app-stack`.
IntermediateTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer
Likely causes → Another stack imports the output through Fn::ImportValue. CloudFormation will not let you change or remove an export while it is imported.
Diagnose →
aws cloudformation list-imports --export-name network-VpcId
aws cloudformation list-exports --query "Exports[?Name=='network-VpcId']"
Fix →
- In the importing stacks, replace
ImportValuewith a hard-coded value or an SSM parameter and deploy them - Then change or remove the export in the producer stack
Prevent → For loose coupling, share values between stacks through SSM Parameter Store ({{resolve:ssm:/network/vpc-id}}) rather than exports.
More on CloudFormation, CloudWatch, KMS, Secrets and Cost
Updating a stack fails: `Stack:arn:aws:cloudformation:...:stack/app/... is in ROLLBACK_COMPLETE state and can not be updated.`BeginnerA stack is stuck in `UPDATE_ROLLBACK_FAILED`.AdvancedA pipeline fails with `An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.`Beginner`InsufficientCapabilitiesException: Requires capabilities : [CAPABILITY_NAMED_IAM]`.BeginnerStack deletion ends in `DELETE_FAILED` with `The bucket you tried to delete is not empty` on an S3 bucket resource.IntermediateDrift detection shows `MODIFIED` on a security group and an RDS instance that someone changed in the console. How do you reconcile?Advanced