Skip to content

‼️ NOTICE: (ec2) VPCs with SubnetType.PRIVATE cause resource destruction on versions >=v1.162.0 & >=1.163.2 #21138

@corymhall

Description

@corymhall

Describe the bug

Please add your +1 👍 to let us know you have encountered this

Status: RESOLVED

Overview:

PR #19320 changed the values of duplicate enums. SubnetType.PRIVATE was changed from Private to Deprecated_Private.

This is causing separate issues on v1 vs v2.

On v1
For example, a basic VPC

new ec2.Vpc(this, 'Vpc', {
      subnetConfiguration: [
        {
          name: 'Private',
          subnetType: ec2.SubnetType.PRIVATE,
        },
        {
          name: 'Public',
          subnetType: ec2.SubnetType.PUBLIC,
        },

      ]
    })

which is causing resources to be destroyed/recreated.

Resources
[-] AWS::EC2::Route VpcPrivateSubnet1DefaultRouteBE02A9ED destroy
[-] AWS::EC2::Route VpcPrivateSubnet2DefaultRoute060D2087 destroy
[-] AWS::EC2::EIP VpcPublicSubnet1EIPD7E02669 destroy
[-] AWS::EC2::NatGateway VpcPublicSubnet1NATGateway4D7517AA destroy
[-] AWS::EC2::EIP VpcPublicSubnet2EIP3C605A87 destroy
[-] AWS::EC2::NatGateway VpcPublicSubnet2NATGateway9182C01D destroy

On v2
SubnetType.PRIVATE has been removed and any code using it will not longer build.

Complete Error Message:

Workaround:

Solution:

Upgrade to v1.164.0

Related Issues:

#21131

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudbugThis issue is a bug.management/trackingIssues that track a subject or multiple issuesp0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions