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

feat(aws-ec2): control over VPC AZs #20562

Merged
merged 2 commits into from
Jun 6, 2022
Merged

feat(aws-ec2): control over VPC AZs #20562

merged 2 commits into from
Jun 6, 2022

Conversation

philipmw
Copy link
Contributor

@philipmw philipmw commented Jun 1, 2022

With this change, the Vpc construct gains a new constructor prop,
availabilityZones, which gives more control over AZs than the existing
maxAzs prop.

closes #5847


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • 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

@gitpod-io
Copy link

gitpod-io bot commented Jun 1, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team June 1, 2022 02:59
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Jun 1, 2022
*
* This option overrides `maxAzs`.
*
* @default (a subset of) AZs of the stack
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @default (a subset of) AZs of the stack
* @default - a subset of AZs of the stack

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

Comment on lines 608 to 612
for (let i = 1; i < 2; i++) {
Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', {
AvailabilityZone: `${stack.region}b`,
});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this loop doesn't do anything, should be:

Suggested change
for (let i = 1; i < 2; i++) {
Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', {
AvailabilityZone: `${stack.region}b`,
});
}
Template.fromStack(stack).hasResourceProperties('AWS::EC2::Subnet', {
AvailabilityZone: `${stack.region}b`,
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, that was a thoughtless copy-paste. Fixed.

@@ -1317,10 +1332,13 @@ export class Vpc extends VpcBase {

Tags.of(this).add(NAME_TAG, props.vpcName || this.node.path);

this.availabilityZones = stack.availabilityZones;
if (props.availabilityZones) {
this.availabilityZones = props.availabilityZones;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect there is validation that should be done on this parameter, to ensure there are no deployment time issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Done.

@comcalvi comcalvi self-assigned this Jun 1, 2022
Copy link
Contributor

@comcalvi comcalvi left a comment

Choose a reason for hiding this comment

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

As this is a feature, please add an integ test for this feature.

@philipmw
Copy link
Contributor Author

philipmw commented Jun 3, 2022

Thanks for the review, @comcalvi . I made the changes you suggested.

comcalvi
comcalvi previously approved these changes Jun 3, 2022
Copy link
Contributor

@comcalvi comcalvi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@mergify mergify bot dismissed comcalvi’s stale review June 3, 2022 23:23

Pull request has been modified.

@philipmw
Copy link
Contributor Author

philipmw commented Jun 3, 2022

@comcalvi Thanks. I don't know if I messed it up, but the branch was out of date so I merged main into it. Now it needs another review from you. Would you please?

With this change, the `Vpc` construct gains a new constructor prop,
`availabilityZones`, which gives more control over AZs than the existing
`maxAzs` prop.

closes aws#5847
@mergify
Copy link
Contributor

mergify bot commented Jun 6, 2022

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 58dffd8 into aws:main Jun 6, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 6, 2022

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).

@fitzoh fitzoh mentioned this pull request Jun 14, 2022
2 tasks
@philipmw philipmw deleted the vpc branch June 16, 2022 16:52
daschaa pushed a commit to daschaa/aws-cdk that referenced this pull request Jul 9, 2022
With this change, the `Vpc` construct gains a new constructor prop,
`availabilityZones`, which gives more control over AZs than the existing
`maxAzs` prop.

closes aws#5847


----

### All Submissions:

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

### Adding new Unconventional Dependencies:

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

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [x] 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*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Control over VPC AZs
3 participants