Skip to content

remove dead EC2NatGateway and EC2Route handlers#3786

Closed
ntner wants to merge 1 commit into
masterfrom
rm-dead-lambda
Closed

remove dead EC2NatGateway and EC2Route handlers#3786
ntner wants to merge 1 commit into
masterfrom
rm-dead-lambda

Conversation

@ntner
Copy link
Copy Markdown
Contributor

@ntner ntner commented Mar 31, 2026

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 route Custom::EC2NatGateway or Custom::EC2Route events. 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 HandleEC2AvailabilityZones handler is unchanged.


How to use it?

This cleanup is automatically included when you update your rack. No additional configuration is required.

$ convox rack update

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 20260406110041 or newer.

  • Check your rack's version with convox rack
  • Update your rack with convox rack update

@ntner ntner requested a review from nightfury1204 March 31, 2026 00:21
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.
@ntner ntner mentioned this pull request Mar 31, 2026
@ntner ntner closed this in #3788 Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant