From 81e847786e6578f5cf381c8599df7c6578cee41a Mon Sep 17 00:00:00 2001 From: Iain Merrick Date: Fri, 26 Apr 2024 15:00:16 +0100 Subject: [PATCH] feat: IPv6 support - turn Route53::RecordSet into a RecordSetGroup with additional AAAA record - change resource name to avoid type error when updating CloudFormation --- src/resources/Api.ts | 26 ++++++++++++++------------ src/resources/Naming.ts | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/resources/Api.ts b/src/resources/Api.ts index 4a451b0a..b6b422f4 100644 --- a/src/resources/Api.ts +++ b/src/resources/Api.ts @@ -277,23 +277,25 @@ export class Api { merge(resources, { [domainRoute53Record]: { - Type: 'AWS::Route53::RecordSet', + Type: 'AWS::Route53::RecordSetGroup', DeletionPolicy: domain.retain ? 'Retain' : 'Delete', Properties: { ...(domain.hostedZoneId ? { HostedZoneId: domain.hostedZoneId } : { HostedZoneName: hostedZoneName }), - Name: domain.name, - Type: 'A', - AliasTarget: { - HostedZoneId: { - 'Fn::GetAtt': [domainNameLogicalId, 'HostedZoneId'], - }, - DNSName: { - 'Fn::GetAtt': [domainNameLogicalId, 'AppSyncDomainName'], - }, - EvaluateTargetHealth: false, - }, + RecordSets: ['A', 'AAAA'].map(Type => ({ + Name: domain.name, + Type, + AliasTarget: { + HostedZoneId: { + 'Fn::GetAtt': [domainNameLogicalId, 'HostedZoneId'], + }, + DNSName: { + 'Fn::GetAtt': [domainNameLogicalId, 'AppSyncDomainName'], + }, + EvaluateTargetHealth: false, + } + })) }, }, }); diff --git a/src/resources/Naming.ts b/src/resources/Naming.ts index d3b3cacb..4a2a4a71 100644 --- a/src/resources/Naming.ts +++ b/src/resources/Naming.ts @@ -36,7 +36,7 @@ export class Naming { } getDomainReoute53RecordLogicalId() { - return this.getLogicalId(`GraphQlDomainRoute53Record`); + return this.getLogicalId(`GraphQlDomainRoute53Records`); } getLogGroupLogicalId() {