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

fix(ec2): deploying an isolated subnet fails when ipv6AssignAddressOnCreation is set to true #28902

Merged
merged 5 commits into from Feb 3, 2024

Conversation

badmintoncryer
Copy link
Contributor

@badmintoncryer badmintoncryer commented Jan 28, 2024

This PR resolves the issue where deploying an isolated subnet with ipv6AssignAddressOnCreation enabled fails.

example

new Vpc(stack, 'TheVPC', {
        ipProtocol: IpProtocol.DUAL_STACK,
        subnetConfiguration: [
          {
            subnetType: testData.subnetType,
            name: 'subnetName',
            ipv6AssignAddressOnCreation: true,
          },
        ],
      });

error

6:39:48 PM | CREATE_FAILED        | AWS::EC2::Subnet                      | vpcisolatedSubnet1Subnet06BBE51F
Template error: Fn::Select  cannot select nonexistent value at index 0

solution

A dependency on the CidrBlock has been added as discussed in issue.

      (this.isolatedSubnets as PrivateSubnet[]).forEach((isolatedSubnet) => {
        if (this.ipv6CidrBlock !== undefined) {
          isolatedSubnet.node.addDependency(this.ipv6CidrBlock);
        }
      });

Question

This modification results in the failure of existing integration tests.
I don't consider this change to be a breaking one, so I went ahead and updated the snapshot. Is that okay?

  CHANGED    aws-ec2/test/integ.vpc-dual-stack-ec2 0.776s
      Resources
[~] AWS::EC2::Subnet Ip6VpcDualStackPrivateSubnet1Subnet842B7F4C 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::RouteTable Ip6VpcDualStackPrivateSubnet1RouteTable5326D239 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::SubnetRouteTableAssociation Ip6VpcDualStackPrivateSubnet1RouteTableAssociationF1C10B6A 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::Subnet Ip6VpcDualStackPrivateSubnet2SubnetEB493489 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::RouteTable Ip6VpcDualStackPrivateSubnet2RouteTable56BF517C 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::SubnetRouteTableAssociation Ip6VpcDualStackPrivateSubnet2RouteTableAssociationD37A3D3D 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]

Closes #28843


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

@github-actions github-actions bot added admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1 labels Jan 28, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review January 29, 2024 17:01

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 30, 2024
@ConnorRobertson
Copy link
Contributor

Yeah I think this looks good to me. The added dependency shouldn't be a breaking change in this case I think as well.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 039f305
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Feb 3, 2024
Copy link
Contributor

mergify bot commented Feb 3, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 9de77bb into aws:main Feb 3, 2024
13 checks passed
@badmintoncryer badmintoncryer deleted the 28843-ipv6InIsolatedSubnet branch February 3, 2024 03:13
SankyRed pushed a commit that referenced this pull request Feb 8, 2024
…nCreation` is set to true (#28902)

This PR resolves the issue where deploying an isolated subnet with `ipv6AssignAddressOnCreation` enabled fails. 

### example
```ts
new Vpc(stack, 'TheVPC', {
        ipProtocol: IpProtocol.DUAL_STACK,
        subnetConfiguration: [
          {
            subnetType: testData.subnetType,
            name: 'subnetName',
            ipv6AssignAddressOnCreation: true,
          },
        ],
      });
```

### error
```sh
6:39:48 PM | CREATE_FAILED        | AWS::EC2::Subnet                      | vpcisolatedSubnet1Subnet06BBE51F
Template error: Fn::Select  cannot select nonexistent value at index 0
```

### solution
A dependency on the CidrBlock has been added [as discussed in issue](#28843 (comment)).

```ts
      (this.isolatedSubnets as PrivateSubnet[]).forEach((isolatedSubnet) => {
        if (this.ipv6CidrBlock !== undefined) {
          isolatedSubnet.node.addDependency(this.ipv6CidrBlock);
        }
      });
```


## Question
This modification results in the failure of existing integration tests.
I don't consider this change to be a breaking one, so I went ahead and updated the snapshot. Is that okay?
```sh
  CHANGED    aws-ec2/test/integ.vpc-dual-stack-ec2 0.776s
      Resources
[~] AWS::EC2::Subnet Ip6VpcDualStackPrivateSubnet1Subnet842B7F4C 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::RouteTable Ip6VpcDualStackPrivateSubnet1RouteTable5326D239 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::SubnetRouteTableAssociation Ip6VpcDualStackPrivateSubnet1RouteTableAssociationF1C10B6A 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::Subnet Ip6VpcDualStackPrivateSubnet2SubnetEB493489 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::RouteTable Ip6VpcDualStackPrivateSubnet2RouteTable56BF517C 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::SubnetRouteTableAssociation Ip6VpcDualStackPrivateSubnet2RouteTableAssociationD37A3D3D 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
```

Closes #28843

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TheRealAmazonKendra pushed a commit that referenced this pull request Feb 9, 2024
…nCreation` is set to true (#28902)

This PR resolves the issue where deploying an isolated subnet with `ipv6AssignAddressOnCreation` enabled fails. 

### example
```ts
new Vpc(stack, 'TheVPC', {
        ipProtocol: IpProtocol.DUAL_STACK,
        subnetConfiguration: [
          {
            subnetType: testData.subnetType,
            name: 'subnetName',
            ipv6AssignAddressOnCreation: true,
          },
        ],
      });
```

### error
```sh
6:39:48 PM | CREATE_FAILED        | AWS::EC2::Subnet                      | vpcisolatedSubnet1Subnet06BBE51F
Template error: Fn::Select  cannot select nonexistent value at index 0
```

### solution
A dependency on the CidrBlock has been added [as discussed in issue](#28843 (comment)).

```ts
      (this.isolatedSubnets as PrivateSubnet[]).forEach((isolatedSubnet) => {
        if (this.ipv6CidrBlock !== undefined) {
          isolatedSubnet.node.addDependency(this.ipv6CidrBlock);
        }
      });
```


## Question
This modification results in the failure of existing integration tests.
I don't consider this change to be a breaking one, so I went ahead and updated the snapshot. Is that okay?
```sh
  CHANGED    aws-ec2/test/integ.vpc-dual-stack-ec2 0.776s
      Resources
[~] AWS::EC2::Subnet Ip6VpcDualStackPrivateSubnet1Subnet842B7F4C 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::RouteTable Ip6VpcDualStackPrivateSubnet1RouteTable5326D239 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::SubnetRouteTableAssociation Ip6VpcDualStackPrivateSubnet1RouteTableAssociationF1C10B6A 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::Subnet Ip6VpcDualStackPrivateSubnet2SubnetEB493489 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::RouteTable Ip6VpcDualStackPrivateSubnet2RouteTable56BF517C 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
[~] AWS::EC2::SubnetRouteTableAssociation Ip6VpcDualStackPrivateSubnet2RouteTableAssociationD37A3D3D 
 └─ [+] DependsOn
     └─ ["Ip6VpcDualStackipv6cidr40BE830A"]
```

Closes #28843

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(ec2): ipv6AssignAddressOnCreation(true) on isolated subnet configuration produces an error
3 participants