Fix sst remove failing on in-use ACM certificate by ordering load Balancer deletion first. - #6938
Open
MalekD5 wants to merge 1 commit into
Open
Fix sst remove failing on in-use ACM certificate by ordering load Balancer deletion first.#6938MalekD5 wants to merge 1 commit into
MalekD5 wants to merge 1 commit into
Conversation
…ancer deletion first.
omercnet
approved these changes
Aug 28, 2026
omercnet
left a comment
There was a problem hiding this comment.
Verified the fix across Alb, Service, and Service v1. The explicit load-balancer dependency expands through DnsValidatedCertificate to the ACM certificate and validation resources, so Pulumi's reverse destroy order removes the listener and load balancer before deleting the certificate. Both the direct component dependency used by Alb and the Output-wrapped component dependency used by Service were exercised with Pulumi mock-monitor graph probes. Platform typecheck and build pass. The existing focused Vitest files could not collect because platform/src/global.d.ts imports @types/node as a runtime package; that failure is pre-existing and unrelated to this diff.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #6934
Problem Summary
The load balancer's Elastic Network Interface (ENI) release sometimes delays, and when the ACM certificate delete fires while the ENIs still reference the certificate, you get
ResourceInUseExceptionand the removal aborts before it ever reaches the load balancer.This issue is not deterministic by nature, and most of the time we are at the mercy of AWS-side timings so it not as obvious.
Fix
The way this PR fixes the problem is by explicitly making the ALB depend on the ACM Certificate. Here is the base config I used for testing:
Here is the before and after
sst state exportafter running deploy:Before

As you can notice, no ACM URNs in dependencies, which means your run's success is timing luck.
After

As you can notice, ACM URNS in dependency array ordered, which means LB delete must fully complete before ACM delete starts every run. And we are no longer under the mercy of AWS-side timing.