Skip to content

feat(ec2): add vpcName property to the VPC#17940

Merged
mergify[bot] merged 3 commits intoaws:masterfrom
hguillermo:vpc-name-as-prop
Dec 10, 2021
Merged

feat(ec2): add vpcName property to the VPC#17940
mergify[bot] merged 3 commits intoaws:masterfrom
hguillermo:vpc-name-as-prop

Conversation

@hguillermo
Copy link
Copy Markdown
Contributor

Issue
When creating a VPC you can not define the VPC name. The current way to set the name is using the Tags class

VPC Example:

        const vpc = new ec2.Vpc(this, 'vpc-id', {
            maxAzs: 2,
            subnetConfiguration: [
                {
                    name: 'private-subnet-1',
                    subnetType: ec2.SubnetType.PRIVATE,
                    cidrMask: 24,
                },
                {
                    name: 'public-subnet-1',
                    subnetType: ec2.SubnetType.PUBLIC,
                    cidrMask: 24,
                },
            ]
        });

        cdk.Tags.of(vpc).add('Name', 'CustomVPCName');

Proposal:

        const vpc = new ec2.Vpc(this, 'vpc-id', {
            maxAzs: 2,
            subnetConfiguration: [
                {
                    name: 'private-subnet-1',
                    subnetType: ec2.SubnetType.PRIVATE,
                    cidrMask: 24,
                },
                {
                    name: 'public-subnet-1',
                    subnetType: ec2.SubnetType.PUBLIC,
                    cidrMask: 24,
                    mapPublicIpOnLaunch: false, // or true
                },
            ],
            vpcName: 'CustomVPCName',
        });

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
Copy Markdown

gitpod-io bot commented Dec 10, 2021

@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Dec 10, 2021
@hguillermo
Copy link
Copy Markdown
Contributor Author

@njlynch Do I need to update the README for this small change?

@njlynch njlynch changed the title feat(ec2): Added vpcName property to the VPC construct props feat(ec2): add vpcName property to the VPC Dec 10, 2021
@njlynch njlynch added the pr-linter/exempt-readme The PR linter will not require README changes label Dec 10, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Dec 10, 2021

Thank you for contributing! Your pull request will be updated from master 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
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 1658d4a
  • 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 794e7cd into aws:master Dec 10, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Dec 10, 2021

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

@hguillermo hguillermo deleted the vpc-name-as-prop branch December 10, 2021 17:55
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
**Issue**
When creating a VPC you can not define the VPC name. The current way to set the name is using the `Tags` class

**VPC Example:**
```javascript
        const vpc = new ec2.Vpc(this, 'vpc-id', {
            maxAzs: 2,
            subnetConfiguration: [
                {
                    name: 'private-subnet-1',
                    subnetType: ec2.SubnetType.PRIVATE,
                    cidrMask: 24,
                },
                {
                    name: 'public-subnet-1',
                    subnetType: ec2.SubnetType.PUBLIC,
                    cidrMask: 24,
                },
            ]
        });

        cdk.Tags.of(vpc).add('Name', 'CustomVPCName');
```

**Proposal:**
```javascript
        const vpc = new ec2.Vpc(this, 'vpc-id', {
            maxAzs: 2,
            subnetConfiguration: [
                {
                    name: 'private-subnet-1',
                    subnetType: ec2.SubnetType.PRIVATE,
                    cidrMask: 24,
                },
                {
                    name: 'public-subnet-1',
                    subnetType: ec2.SubnetType.PUBLIC,
                    cidrMask: 24,
                    mapPublicIpOnLaunch: false, // or true
                },
            ],
            vpcName: 'CustomVPCName',
        });
```

*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

@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud pr-linter/exempt-readme The PR linter will not require README changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants