Navigation Menu

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(appmesh): add listener TLS certificates for VirtualNodes and VirtualGateways #11863

Merged
merged 12 commits into from Jan 12, 2021

Conversation

alexbrjo
Copy link
Contributor

@alexbrjo alexbrjo commented Dec 4, 2020

This change allows customers to include an ACM certificiate or specify a file certificate for their listeners to use to terminate TLS. #10051

const cert = new Certificate(stack, 'cert', {
  domainName: '',
});

new appmesh.VirtualNode(stack, 'test-node', {
  mesh,
  dnsHostName: 'test',
  listeners: [appmesh.VirtualNodeListener.grpc({
    port: 80,
    tlsCertificate: appmesh.TlsCertificate.acm({
      acmCertificate: cert,
      tlsMode: TlsMode.STRICT,
    }),
  },
  )],
});

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

specify a file certificate for their listeners to use to terminate
TLS.
@gitpod-io
Copy link

gitpod-io bot commented Dec 4, 2020

@mergify
Copy link
Contributor

mergify bot commented Dec 4, 2020

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@alexbrjo
Copy link
Contributor Author

alexbrjo commented Dec 4, 2020

rebased this on the updated master branch. I must've forgot to re-build on local because there are compilation errors :) ... will fix

@skinny85 skinny85 self-assigned this Dec 4, 2020
@skinny85 skinny85 changed the title [AWS App Mesh] Add listener TLS certificates for VirtualNodes and VirtualGateways feat(appmesh): add listener TLS certificates for VirtualNodes and VirtualGateways Dec 4, 2020
@github-actions github-actions bot added the @aws-cdk/aws-appmesh Related to AWS App Mesh label Dec 4, 2020
Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looking good @alexbrjo ! Some minor comments/questions.

packages/@aws-cdk/aws-appmesh/README.md Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts Outdated Show resolved Hide resolved
*
* @default - none
*/
readonly abstract tlsMode: TlsMode;
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't expose this, I don't think there's any reason to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tlsMode is referenced in listeners renderTls() function. I prefer setting it here because we might add fields to the tls shape that will depend on fields not in tls-certificate. However if you have a reason for not exposing this I think I can refactor it in a future proof way.

function renderTls(scope: cdk.Construct, tlsCertificate: TlsCertificate): CfnVirtualGateway.VirtualGatewayListenerTlsProperty {
  return {
    certificate: tlsCertificate.bind(scope).tlsCertificate,
    mode: tlsCertificate.tlsMode.toString(),
  };
}

packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed skinny85’s stale review December 11, 2020 17:42

Pull request has been modified.

@alexbrjo
Copy link
Contributor Author

There's one outstanding thread about access control for TlsMode, but I believe I've addressed all the other comments.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks good @alexbrjo ! I'd like to take this opportunity to get rid of some duplication in VirtualGatewayListener that creeped in before your change. I think we need to clean it up!

packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/tls-certificate.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/test/test.virtual-node.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-appmesh/lib/virtual-node-listener.ts Outdated Show resolved Hide resolved
@alexbrjo
Copy link
Contributor Author

@skinny85 Adopted all the changes you suggested from this last review. Thanks for explaining the redundancy part more, I assumed you were talking about code duplicated between Virtual Node and Virtual Gateway.

@mergify mergify bot dismissed skinny85’s stale review December 22, 2020 00:43

Pull request has been modified.

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks great @alexbrjo ! The only thing I'm surprised about is why is the tlsMode property now required...?

/**
* The TLS mode.
*/
readonly tlsMode: TlsMode;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be optional, and should be defaulted by the classes that use this interface.


function renderHealthCheck(
Copy link
Contributor

Choose a reason for hiding this comment

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

For the sake of making the diff read better, let's leave this as a function (and let's also make renderTls a function instead of a method).

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Putting in "Request changes" to take it off my ToDo list - @alexbrjo , you ned to resolve the conflicts with master, once you do, please re-request my review, and I'll take a look!

@mergify mergify bot dismissed skinny85’s stale review January 6, 2021 19:28

Pull request has been modified.

Copy link
Contributor

@dfezzie dfezzie left a comment

Choose a reason for hiding this comment

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

General implementation looks good from my perspective

Copy link
Contributor

@skinny85 skinny85 left a comment

Choose a reason for hiding this comment

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

Looks perfect @alexbrjo !

/**
* Returns TLS certificate based provider.
*/
public abstract bind(_scope: cdk.Construct): TlsCertificateConfig;
Copy link
Contributor

Choose a reason for hiding this comment

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

You can safely call this scope, the "unused parameter" validation does not apply to abstract methods 🙂.

@mergify
Copy link
Contributor

mergify bot commented Jan 12, 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
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: d83838e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify
Copy link
Contributor

mergify bot commented Jan 12, 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).

@mergify mergify bot merged commit 175a257 into aws:master Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appmesh Related to AWS App Mesh
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants