Skip to content

Commit

Permalink
A record type fix (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
NChitty authored Mar 20, 2024
1 parent 6e1e358 commit da9a4f7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cdk/lib/application-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
PublicHostedZone,
RecordTarget,
} from 'aws-cdk-lib/aws-route53';
import { ApiGateway } from 'aws-cdk-lib/aws-route53-targets';
import { ApiGatewayDomain } from 'aws-cdk-lib/aws-route53-targets';

export interface ApplicationLayerStackProps extends StackProps {
readonly delegationRole: Role;
Expand Down Expand Up @@ -85,10 +85,15 @@ export default class ApplicationLayerStack extends Stack {
},
});

const apiDomainName = api.domainName || api.addDomainName('ApiDomainName', {
domainName,
certificate,
});

new ARecord(this, 'ApiAliasRecord', {
zone: hostedZone,
recordName: 'api',
target: RecordTarget.fromAlias(new ApiGateway(api)),
target: RecordTarget.fromAlias(new ApiGatewayDomain(apiDomainName)),
});
}
}

0 comments on commit da9a4f7

Please sign in to comment.