From 00fe4fdce32ed9427a34e1d274acbccc191e65a3 Mon Sep 17 00:00:00 2001 From: Dominic Breuker Date: Wed, 30 Oct 2024 21:22:22 +0100 Subject: [PATCH 1/2] add support for Route53 Alias records in route53 command --- aws/route53.go | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/aws/route53.go b/aws/route53.go index 1a7f2ac..800ec45 100644 --- a/aws/route53.go +++ b/aws/route53.go @@ -237,15 +237,27 @@ func (m *Route53Module) getRoute53Records() { for _, resourceRecord := range record.ResourceRecords { recordValue := resourceRecord.Value - m.Records = append( - m.Records, - Record{ - AWSService: "Route53", - Name: recordName, - Type: recordType, - Value: aws.ToString(recordValue), - PrivateZone: privateZone, - }) + if record.AliasTarget != nil { + m.Records = append( + m.Records, + Record{ + AWSService: "Route53", + Name: recordName, + Type: fmt.Sprintf("Alias[%s]", recordType), + Value: aws.ToString(record.AliasTarget.DNSName), + PrivateZone: privateZone, + }) + } else { + m.Records = append( + m.Records, + Record{ + AWSService: "Route53", + Name: recordName, + Type: recordType, + Value: aws.ToString(recordValue), + PrivateZone: privateZone, + }) + } } } From ab4866fcbff0f23871267e16cb305479ccc850e9 Mon Sep 17 00:00:00 2001 From: Dominic Breuker Date: Wed, 13 Nov 2024 21:24:17 +0100 Subject: [PATCH 2/2] fix bug with route53 alias record processing --- aws/route53.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/aws/route53.go b/aws/route53.go index 800ec45..652d76d 100644 --- a/aws/route53.go +++ b/aws/route53.go @@ -235,19 +235,19 @@ func (m *Route53Module) getRoute53Records() { recordName = aws.ToString(record.Name) recordType = string(record.Type) - for _, resourceRecord := range record.ResourceRecords { - recordValue := resourceRecord.Value - if record.AliasTarget != nil { - m.Records = append( - m.Records, - Record{ - AWSService: "Route53", - Name: recordName, - Type: fmt.Sprintf("Alias[%s]", recordType), - Value: aws.ToString(record.AliasTarget.DNSName), - PrivateZone: privateZone, - }) - } else { + if record.AliasTarget != nil { + m.Records = append( + m.Records, + Record{ + AWSService: "Route53", + Name: recordName, + Type: fmt.Sprintf("Alias[%s]", recordType), + Value: aws.ToString(record.AliasTarget.DNSName), + PrivateZone: privateZone, + }) + } else { + for _, resourceRecord := range record.ResourceRecords { + recordValue := resourceRecord.Value m.Records = append( m.Records, Record{ @@ -258,8 +258,8 @@ func (m *Route53Module) getRoute53Records() { PrivateZone: privateZone, }) } - } + } }