Skip to content

Commit d48aafb

Browse files
committed
add static site cfn outputs
1 parent 20f54fe commit d48aafb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pipeline/lib/static-site-stack.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export class StaticSiteStack extends cdk.Stack {
1616

1717
const zone = route53.HostedZone.fromLookup(this, 'Zone', { domainName: props.domainName });
1818
const siteDomain = `${props.siteSubDomain}.${props.domainName}`;
19+
new cdk.CfnOutput(this, "Site", { value: "https://" + siteDomain })
20+
1921
// The code that defines your stack goes here
2022
const siteBucket = new s3.Bucket(this, 'SiteBucket', {
2123
bucketName: siteDomain,
@@ -28,6 +30,8 @@ export class StaticSiteStack extends cdk.Stack {
2830
// DESTROY, cdk destroy will attempt to delete the bucket, but will error if the bucket is not empty.
2931
removalPolicy: cdk.RemovalPolicy.DESTROY, // NOT recommended for production code
3032
});
33+
new cdk.CfnOutput(this, "Bucket", { value: siteBucket.bucketName })
34+
3135

3236
const certificateArn = new acm.DnsValidatedCertificate(
3337
this,
@@ -38,6 +42,7 @@ export class StaticSiteStack extends cdk.Stack {
3842
region: "us-east-1", // Cloudfront only checks this region for certificates.
3943
}
4044
).certificateArn
45+
new cdk.CfnOutput(this, "Certificate", { value: certificateArn })
4146

4247
const distribution = new cloudfront.CloudFrontWebDistribution(this, 'SiteDistribution', {
4348
aliasConfiguration: {
@@ -58,6 +63,9 @@ export class StaticSiteStack extends cdk.Stack {
5863
}
5964
]
6065
});
66+
new cdk.CfnOutput(this, "DistributionId", {
67+
value: distribution.distributionId,
68+
})
6169
new route53.ARecord(this, 'SiteAliasRecord', {
6270
recordName: siteDomain,
6371
target: route53.RecordTarget.fromAlias(new targets.CloudFrontTarget(distribution)),

0 commit comments

Comments
 (0)