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: add ACM certificate construct #390

Merged
merged 9 commits into from
Apr 8, 2021
Merged

feat: add ACM certificate construct #390

merged 9 commits into from
Apr 8, 2021

Conversation

jacobwinch
Copy link
Contributor

What does this change?

This change adds a new construct for creating an ACM certificate.

Does this change require changes to existing projects or CDK CLI?

No.

How to test

I've added unit tests to cover the new functionality.

How can we measure success?

We are able to create more resources using @guardian/cdk.

Have we considered potential risks?

Adding a new construct is low risk.

},
"Resources": Object {
"TestCertificate6B4956B6": Object {
"DeletionPolicy": "Retain",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that adding this deletion policy will improve safety and allow us to import certificates created outside of CloudFormation 🤞

import { GuMigratingResource } from "../core/migrating";
import type { GuStatefulConstruct } from "../core/migrating";

type GuCertificateProps = Record<Stage, GuDnsValidatedCertificateProps> & GuMigratingResource;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is my first attempt at using #364 - hopefully this is roughly what you were expecting @akash1810!

Copy link
Member

Choose a reason for hiding this comment

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

Took a second to parse that, but yep looks correct 👍🏽 . You might want to add AppIdentity too so we can add the app tag.

* If your DNS is managed via Route 53, then supplying `hostedZoneId` props will allow AWS to automatically
* validate your certificate.
*
* If your DNS is not managed via Route 53, or you omit the `hostedZoneId` props, then the CloudFormation
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This advice is based on https://github.com/aws/aws-cdk/blob/7966f8d48c4bff26beb22856d289f9d0c7e7081d/packages/%40aws-cdk/aws-certificatemanager/lib/certificate.ts#L101-L116. In the future, perhaps we can use a custom resource to create the appropriate records elsewhere (NS1?) automatically?

@jacobwinch jacobwinch marked this pull request as ready for review April 7, 2021 11:47
@jacobwinch jacobwinch requested a review from a team April 7, 2021 11:47
Copy link
Member

@akash1810 akash1810 left a comment

Choose a reason for hiding this comment

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

Fantastic!

}

/**
* Construct which creates an ACM Certificate.
Copy link
Member

Choose a reason for hiding this comment

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

minor: Should we make it explicit that this is a DNS validated cert? Either by mentioning it in this comment or in the naming of the construct?

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, I've updated the docs.

@jacobwinch jacobwinch merged commit 345995d into main Apr 8, 2021
@jacobwinch jacobwinch deleted the jw-acm-certs branch April 8, 2021 06:41
@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2021

🎉 This PR is included in version 7.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants