@@ -18,6 +18,7 @@ import {
1818 InstanceType ,
1919 SecurityGroup ,
2020} from 'aws-cdk-lib/aws-ec2' ;
21+ import type { CfnLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancing' ;
2122import { HttpCodeTarget } from 'aws-cdk-lib/aws-elasticloadbalancingv2' ;
2223import { Topic } from 'aws-cdk-lib/aws-sns' ;
2324import { CfnInclude } from 'aws-cdk-lib/cloudformation-include' ;
@@ -48,7 +49,7 @@ export class Registration extends GuStack {
4849 // Until this project has been fully migrated to GuCDK you should update the 'old' infrastructure by modifying
4950 // the YAML file and then re-running the snapshot tests to confirm that the changes are being pulled through by
5051 // CDK
51- new CfnInclude ( this , 'YamlTemplate' , {
52+ const template = new CfnInclude ( this , 'YamlTemplate' , {
5253 templateFile : yamlTemplateFilePath ,
5354 } ) ;
5455
@@ -171,13 +172,17 @@ export class Registration extends GuStack {
171172
172173 adjustCloudformationParameters ( this ) ;
173174
175+ const legacyLoadBalancer = template . getResource (
176+ 'LoadBalancerToPrivateASG' ,
177+ ) as CfnLoadBalancer ;
178+
174179 // This CNAME represents the public URL for the registration service.
175180 new GuCname ( this , 'DnsRecordForRegistration' , {
176181 app,
177182 domainName : props . domainName ,
178- // For now we are still routing traffic via the intermediate CNAME, which points at the legacy ELB.
179- // To complete the migration, we'll remove this intermediate CNAME and point at playApp.loadBalancer.loadBalancerDnsName.
180- resourceRecord : props . intermediateCname ,
183+ // For now we are still routing traffic to the legacy ELB.
184+ // To complete the migration, we'll update to point at playApp.loadBalancer.loadBalancerDnsName.
185+ resourceRecord : legacyLoadBalancer . attrDnsName ,
181186
182187 // Intentionally low TTL for faster DNS changes
183188 // TODO increase this to 7200 (2 hours) after the migration is complete
0 commit comments