Skip to content

Commit

Permalink
Fix Route53HostedZone loopvar scoping after migrating to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sbocinec committed Dec 17, 2024
1 parent ffd2e75 commit e2776d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aws/resources/route53_hostedzone.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ func (r *Route53HostedZone) getAll(_ context.Context, configObj config.Config) (
return nil, err
}

for _, zone := range result.HostedZones {
for _, z := range result.HostedZones {
zone := z
if configObj.Route53HostedZone.ShouldInclude(config.ResourceValue{
Name: zone.Name,
}) {
Expand Down Expand Up @@ -68,7 +69,8 @@ func (r *Route53HostedZone) nukeRecordSet(id *string) (err error) {
var domainName = aws.ToString(r.HostedZonesDomains[aws.ToString(id)].Name)

var changes []types.Change
for _, record := range output.ResourceRecordSets {
for _, rec := range output.ResourceRecordSets {
record := rec
// Note : We can't delete the SOA record or the NS record named ${domain-name}.
// Reference : https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-deleting.html
if (record.Type == types.RRTypeNs || record.Type == types.RRTypeSoa) && aws.ToString(record.Name) == domainName {
Expand Down

0 comments on commit e2776d6

Please sign in to comment.