Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(amplify): custom domain certificate #30692

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-amplify-alpha/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Construct } from 'constructs';
import { CfnDomain } from 'aws-cdk-lib/aws-amplify';
import { IApp } from './app';
import { IBranch } from './branch';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';

/**
* Options to add a domain to an application
Expand Down Expand Up @@ -52,6 +53,13 @@ export interface DomainProps extends DomainOptions {
* @default the IAM role from App.grantPrincipal
*/
readonly autoSubDomainIamRole?: iam.IRole;

/**
* The SSL/TLS certificate to use for your custom domain.
*
* @default - use the default certificate that Amplify provisions for you
*/
readonly customCertificate?: acm.ICertificate;
}

/**
Expand Down Expand Up @@ -130,6 +138,10 @@ export class Domain extends Resource {
enableAutoSubDomain: !!props.enableAutoSubdomain,
autoSubDomainCreationPatterns: props.autoSubdomainCreationPatterns || ['*', 'pr*'],
autoSubDomainIamRole: props.autoSubDomainIamRole?.roleArn,
certificateSettings: props.customCertificate ? {
certificateType: 'CUSTOM',
customCertificateArn: props.customCertificate.certificateArn,
} : undefined,
});

this.arn = domain.attrArn;
Expand Down
Loading