Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
corymhall opened this issue Jul 14, 2022 · 5 comments · Fixed by #21140
Assignees
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0

Comments

@corymhall
Copy link
Contributor

corymhall commented Jul 14, 2022

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

@corymhall corymhall added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 14, 2022
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Jul 14, 2022
@corymhall corymhall added management/tracking Issues that track a subject or multiple issues p0 and removed needs-triage This issue or PR still needs to be triaged. labels Jul 14, 2022
@corymhall corymhall pinned this issue Jul 14, 2022
@corymhall corymhall changed the title ‼️ NOTICE: (ec2) SubnetType.PRIVATE breaking in v1.161.0 and removed in v2.31.0 ‼️ NOTICE: (ec2) SubnetType.PRIVATE breaking in v1.162.0 and removed in v2.31.0 Jul 14, 2022
corymhall added a commit to cdklabs/aws-cdk-notices that referenced this issue Jul 14, 2022
corymhall added a commit to cdklabs/aws-cdk-notices that referenced this issue Jul 14, 2022
@corymhall corymhall changed the title ‼️ NOTICE: (ec2) SubnetType.PRIVATE breaking in v1.162.0 and removed in v2.31.0 ‼️ NOTICE: (ec2) VPCs with SubnetType.PRIVATE cause resource destruction on versions >=v1.162.0 & >=1.163.2 Jul 14, 2022
@mergify mergify bot closed this as completed in #21140 Jul 14, 2022
mergify bot pushed a commit that referenced this issue Jul 14, 2022
In #19320, we changed the values of deprecated enums to include a `Deprecated_` prefix. This also meant we had to do some gymnastics in the code to change usages of the value to a switch case. 

However, there were also places in the code that do enum comparison, which uses the enum value. Those comparison points need to also explicitly consider the equivalent deprecated enums.  

Fixes #21131, Fixes #21138 

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
mergify bot pushed a commit that referenced this issue Jul 14, 2022
In #19320, we changed the values of deprecated enums to include a `Deprecated_` prefix. This also meant we had to do some gymnastics in the code to change usages of the value to a switch case.

However, there were also places in the code that do enum comparison, which uses the enum value. Those comparison points need to also explicitly consider the equivalent deprecated enums.

Fixes #21131, Fixes #21138

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*

(cherry picked from commit 0b5123a)
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@corymhall corymhall reopened this Jul 14, 2022
@corymhall
Copy link
Contributor Author

This issue has been fixed in #21140 and will be in the next release v1.164.0 which are working on releasing.

@zhaoyuguang
Copy link

zhaoyuguang commented Jul 17, 2022

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

Hello. @corymhall Please describe the rootcause more clearly, I can't understand the code PRIVATE = 'Deprecated_Private', it will bring such a big impact,Please tell how to affect the resource generation of VPC, thanks

@corymhall
Copy link
Contributor Author

This issue is fixed in v1.164.0.

@RomainMuller RomainMuller unpinned this issue Aug 1, 2022
@github-actions
Copy link

github-actions bot commented Aug 1, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud bug This issue is a bug. management/tracking Issues that track a subject or multiple issues p0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants