Skip to content

Commit

Permalink
feat: set public: false for route53 records when they are in private …
Browse files Browse the repository at this point in the history
…zone

currently all records are marked as public and it's impossible to differentiate between private and public zones
  • Loading branch information
mionskowski-form3 committed Aug 10, 2023
1 parent c0c3aaf commit 03e94b7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/providers/aws/route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (d *route53Provider) GetResource(ctx context.Context) (*schema.Resources, e
return nil, errors.Wrap(err, "could not list hosted zones")
}
for _, zone := range zoneOutput.HostedZones {
items, err := d.listResourceRecords(*zone.Id)
items, err := d.listResourceRecords(zone)
if err != nil {
return nil, errors.Wrap(err, "could not list hosted zones records")
}
Expand All @@ -44,8 +44,9 @@ func (d *route53Provider) GetResource(ctx context.Context) (*schema.Resources, e
}

// listResourceRecords lists the resource records for a hosted route53 zone.
func (d *route53Provider) listResourceRecords(zone string) (*schema.Resources, error) {
req := &route53.ListResourceRecordSetsInput{HostedZoneId: aws.String(zone)}
func (d *route53Provider) listResourceRecords(zone *route53.HostedZone) (*schema.Resources, error) {
public := !*zone.Config.PrivateZone
req := &route53.ListResourceRecordSetsInput{HostedZoneId: aws.String(*zone.Id)}
list := schema.NewResources()

for {
Expand All @@ -65,13 +66,13 @@ func (d *route53Provider) listResourceRecords(zone string) (*schema.Resources, e
}
list.Append(&schema.Resource{
ID: d.id,
Public: true,
Public: public,
DNSName: name,
Provider: providerName,
})
list.Append(&schema.Resource{
ID: d.id,
Public: true,
Public: public,
PublicIPv4: ip4,
Provider: providerName,
})
Expand Down

0 comments on commit 03e94b7

Please sign in to comment.