Skip to content

feat(ec2): add addSecurityGroup method to launth template#25697

Merged
mergify[bot] merged 4 commits intoaws:mainfrom
kuredev:feature/add-addsecuritygroup-launchtemplate
Jun 15, 2023
Merged

feat(ec2): add addSecurityGroup method to launth template#25697
mergify[bot] merged 4 commits intoaws:mainfrom
kuredev:feature/add-addsecuritygroup-launchtemplate

Conversation

@kuredev
Copy link
Copy Markdown
Contributor

@kuredev kuredev commented May 23, 2023

LaunchTemplateProps is able to process a single securityGroup.
Currently we are required to use connections when we wanted to use multiple security groups. #18712 (comment)
I implemented addSecurityGroup method to make this easier.

Closes #18712


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 May 23, 2023

@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels May 23, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team May 23, 2023 15:14
Copy link
Copy Markdown
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.

@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch from 08bdfc4 to a13ebdf Compare May 25, 2023 14:19
@kuredev kuredev changed the title add addSecurityGroup method to launth template feat(ec2): add addSecurityGroup method to launth template May 25, 2023
@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch 2 times, most recently from 0c8910f to d25a187 Compare May 27, 2023 14:08
@kuredev kuredev closed this Jun 1, 2023
@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch from d25a187 to cdafcc5 Compare June 1, 2023 14:39
@kuredev kuredev reopened this Jun 1, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 1, 2023 14:46

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

@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch 6 times, most recently from 563ef61 to c5e1a8b Compare June 2, 2023 11:25
Copy link
Copy Markdown
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.

@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch 2 times, most recently from 2e6adaf to b8f9851 Compare June 2, 2023 15:35
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 2, 2023 15:37

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

@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch 5 times, most recently from 4107865 to decf58d Compare June 5, 2023 15:50
@kuredev kuredev force-pushed the feature/add-addsecuritygroup-launchtemplate branch from decf58d to 11770cf Compare June 5, 2023 15:52
@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. labels Jun 5, 2023
@kuredev kuredev marked this pull request as ready for review June 5, 2023 22:49
*/
public addSecurityGroup(securityGroup: ISecurityGroup): void {
if (!this._connections) {
throw new Error('LaunchTemplate can only be added a securityGroup if another securityGroup is initialized in the constructor.');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your comment.
Because I understood that _connections is initialized only in the constructor.
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ec2/lib/launch-template.ts#L585

If _connections wasn't initialized in the constructor, an error occurs when trying to call addSecurityGroup here.

otaviomacedo
otaviomacedo previously approved these changes Jun 14, 2023
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jun 14, 2023

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

@kuredev
Copy link
Copy Markdown
Contributor Author

kuredev commented Jun 14, 2023

@Mergifyio requeue

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jun 14, 2023

requeue

❌ Command disallowed due to command restrictions in the Mergify configuration.

Details
  • sender-permission>=write

@mergify mergify bot dismissed otaviomacedo’s stale review June 14, 2023 14:04

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jun 14, 2023
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jun 15, 2023

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

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 52e6de4
  • 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 28df618 into aws:main Jun 15, 2023
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Jun 15, 2023

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

@kuredev kuredev deleted the feature/add-addsecuritygroup-launchtemplate branch June 15, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ec2): Launch template support for multiple security groups

3 participants