remove dead EC2NatGateway and EC2Route handlers#3786
Closed
ntner wants to merge 1 commit into
Closed
Conversation
ntner
added a commit
that referenced
this pull request
Mar 31, 2026
## Summary - Remove 4 dead functions from `provider/aws/lambda/formation/handler/ec2.go` - Remove unused `time` and `awserr` imports ## Details Removed four functions that are fully dead code: - `HandleEC2NatGateway` — NOT dispatched in the formation handler switch (`formation.go:166-192`) - `HandleEC2Route` — NOT dispatched in the formation handler switch - `EC2NatGatewayDelete` — marked `// TODO: delete`, unreachable - `EC2RouteDelete` — marked `// TODO: delete`, unreachable These handlers were previously deprecated (Create/Update already returned "no longer available" errors). The dispatch table in `formation.go` only routes `Custom::EC2AvailabilityZones` — neither `Custom::EC2NatGateway` nor `Custom::EC2Route` are dispatched. No CloudFormation templates reference these custom resource types (confirmed via grep). `HandleEC2AvailabilityZones` and its helper functions are kept — this handler IS actively dispatched. 100 lines deleted, 0 added (net of import cleanup). ## Backward Compatibility If an extremely old stack (pre-deprecation) were deleted, CloudFormation would send a Delete event for `Custom::EC2NatGateway` or `Custom::EC2Route`. This already hits the `default: unknown ResourceType` error in the dispatch table (since these handlers aren't dispatched). CloudFormation eventually times out and proceeds. Removing the dead functions does not change this behavior — they were already unreachable.
ntner
added a commit
that referenced
this pull request
Mar 31, 2026
## Summary - Remove 4 dead functions from `provider/aws/lambda/formation/handler/ec2.go` - Remove unused `time` and `awserr` imports ## Details Removed four functions that are fully dead code: - `HandleEC2NatGateway` — NOT dispatched in the formation handler switch (`formation.go:166-192`) - `HandleEC2Route` — NOT dispatched in the formation handler switch - `EC2NatGatewayDelete` — marked `// TODO: delete`, unreachable - `EC2RouteDelete` — marked `// TODO: delete`, unreachable These handlers were previously deprecated (Create/Update already returned "no longer available" errors). The dispatch table in `formation.go` only routes `Custom::EC2AvailabilityZones` — neither `Custom::EC2NatGateway` nor `Custom::EC2Route` are dispatched. No CloudFormation templates reference these custom resource types (confirmed via grep). `HandleEC2AvailabilityZones` and its helper functions are kept — this handler IS actively dispatched. 100 lines deleted, 0 added (net of import cleanup). ## Backward Compatibility If an extremely old stack (pre-deprecation) were deleted, CloudFormation would send a Delete event for `Custom::EC2NatGateway` or `Custom::EC2Route`. This already hits the `default: unknown ResourceType` error in the dispatch table (since these handlers aren't dispatched). CloudFormation eventually times out and proceeds. Removing the dead functions does not change this behavior — they were already unreachable.
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.
What is the feature/update/fix?
Update: Remove Dead EC2NatGateway and EC2Route Handlers
Removed four unreachable functions from the CloudFormation custom resource handler:
HandleEC2NatGateway,HandleEC2Route, and their associated delete helpers. These handlers were previously deprecated (Create/Update already returned "no longer available" errors) and were never dispatched — the formation handler switch table does not routeCustom::EC2NatGatewayorCustom::EC2Routeevents. No CloudFormation templates reference these custom resource types.This is a code cleanup with no impact on rack behavior or deployed infrastructure. The actively used
HandleEC2AvailabilityZoneshandler is unchanged.How to use it?
This cleanup is automatically included when you update your rack. No additional configuration is required.
Does it have a breaking change?
No breaking changes. The removed code was already unreachable and had no effect on rack operations.
Requirements
To receive this update, you must update to rack version
20260406110041or newer.convox rackconvox rack update