mirror of
https://github.com/lyx0/noury.li.git
synced 2024-11-13 19:49:54 +01:00
33 lines
1 KiB
TypeScript
33 lines
1 KiB
TypeScript
import { CfnOutput, Stack, StackProps } from "aws-cdk-lib";
|
|
import { DnsValidatedCertificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
import { HostedZone, IHostedZone } from "aws-cdk-lib/aws-route53";
|
|
import { Construct } from "constructs";
|
|
import { hostedZoneId, website_domain } from "./variables";
|
|
|
|
export class CertificateStack extends Stack {
|
|
public readonly websiteCert: DnsValidatedCertificate;
|
|
public readonly hostedZone: IHostedZone;
|
|
|
|
constructor(scope: Construct, id: string, props?: StackProps) {
|
|
super(scope, id, props);
|
|
|
|
this.hostedZone = HostedZone.fromHostedZoneAttributes(
|
|
this,
|
|
"HostedZoneWithAttrs",
|
|
{
|
|
hostedZoneId,
|
|
zoneName: website_domain,
|
|
}
|
|
);
|
|
|
|
this.websiteCert = new DnsValidatedCertificate(this, "MinWizSSL", {
|
|
domainName: website_domain,
|
|
subjectAlternativeNames: [`www.${website_domain}`],
|
|
hostedZone: this.hostedZone,
|
|
});
|
|
|
|
new CfnOutput(this, "WebsiteCertArn", {
|
|
value: this.websiteCert.certificateArn,
|
|
});
|
|
}
|
|
}
|