Skip to content

ec2: changes to enum values breaks deprecated enums for v1 #21131

@c0state

Description

@c0state

Describe the bug

Starting with CDK version 1.162.0, if I previously had deployed a VPC with subnet of type ec2.SubnetType.PRIVATE (I understand that it's deprecated now), then simply updating to CDK 1.162.0 and running a deploy ends up causing the CDK to try to delete a bunch of NAT gateways, elastic IPs, and routes. If I change the type to ec2.SubnetType.PRIVATE_WITH_NAT, it doesn't do this.

I thought ec2.SubnetType.PRIVATE and ec2.SubnetType.PRIVATE_WITH_NAT were equivalent?

There were a bunch of changes to the consts to clarify private, public and/or isolated subnets recently. I'm assuming something there is causing this.

Expected Behavior

Updating the CDK to 1.162.0 without changes to our stack configuration shouldn't remove existing NAT gateways, elastic IPs or routes from a VPC

Current Behavior

Updating the CDK with a VPC that has a subnet with a type of PRIVATE causes the diff to show a deletion of various NAT gateways, elastic IPs and routes.

Reproduction Steps

Deploy a VPC with a subnet of type PRIVATE with CDK version v1.161.0.
Then simply update to v1.162.0 and run a diff--it will inexplicably try to delete various NAT gateways, elastic IPs and routes.

Possible Solution

It looks like changing the type to PRIVATE_WITH_NAT fixes this but as stated above, I thought PRIVATE and PRIVATE_WITH_NAT were the same.

Additional Information/Context

No response

CDK CLI Version

1.162.0

Framework Version

1.162.0

Node.js Version

v16.16.0

OS

macOS

Language

Typescript

Language Version

4.7.4

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudbugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions