@@ -6,6 +6,7 @@ import { GuVpcParameter } from '@guardian/cdk/lib/constructs/core';
66import { GuLoggingStreamNameParameter } from '@guardian/cdk/lib/constructs/core' ;
77import { GuDistributionBucketParameter } from '@guardian/cdk/lib/constructs/core' ;
88import { GuStack } from '@guardian/cdk/lib/constructs/core' ;
9+ import { GuCname } from '@guardian/cdk/lib/constructs/dns' ;
910import { GuAllowPolicy } from '@guardian/cdk/lib/constructs/iam' ;
1011import type { App } from 'aws-cdk-lib' ;
1112import { Tags } from 'aws-cdk-lib' ;
@@ -18,6 +19,10 @@ export interface ReportProps extends GuStackProps {
1819 domainName :
1920 | 'report.notifications.guardianapis.com'
2021 | 'report.notifications.code.dev-guardianapis.com' ;
22+ // This maps to the DnsRecord resource in Route53; we can remove this complexity as part of the DNS switchover
23+ intermediateCname :
24+ | 'report.notifications-aws.guardianapis.com.'
25+ | 'report.notifications-aws.code.dev-guardianapis.com.' ;
2126 instanceMetricGranularity : '1Minute' | '5Minute' ;
2227 loggingStreamParameterName :
2328 | '/account/services/logging.stream.name'
@@ -141,5 +146,14 @@ export class Report extends GuStack {
141146 GuLoggingStreamNameParameter . getInstance ( this ) ;
142147 loggingStreamParameter . allowedValues = [ props . loggingStreamParameterName ] ;
143148 loggingStreamParameter . default = props . loggingStreamParameterName ;
149+
150+ new GuCname ( this , 'DnsRecordForReport' , {
151+ app,
152+ domainName : props . domainName ,
153+ // For now we are still routing traffic via the intermediate CNAME, which points at the legacy ELB.
154+ // To complete the migration, we'll remove this intermediate CNAME and point at playApp.loadBalancer.loadBalancerDnsName.
155+ resourceRecord : props . intermediateCname ,
156+ ttl : Duration . seconds ( 3600 ) ,
157+ } ) ;
144158 }
145159}
0 commit comments