Skip to content

Commit

Permalink
Call route53.ListResourceRecordSets with MaxItems = 1
Browse files Browse the repository at this point in the history
Otherwise AWS returns ALL routes with name > requested one.

Signed-off-by: Max Melentyev <max.melentyev@reddit.com>
  • Loading branch information
max-melentyev committed Apr 15, 2024
1 parent 6b788cb commit 3a49d97
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/clients/resourcerecordset/resourcerecordset.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ func NewClient(cfg aws.Config) Client {
// GetResourceRecordSet returns recordSet if present or err
func GetResourceRecordSet(ctx context.Context, name string, params v1alpha1.ResourceRecordSetParameters, c Client) (*route53types.ResourceRecordSet, error) {
res, err := c.ListResourceRecordSets(ctx, &route53.ListResourceRecordSetsInput{
HostedZoneId: params.ZoneID,
StartRecordName: &name,
StartRecordType: route53types.RRType(params.Type),
HostedZoneId: params.ZoneID,
StartRecordName: &name,
StartRecordType: route53types.RRType(params.Type),
StartRecordIdentifier: params.SetIdentifier,
MaxItems: aws.Int32(1),
})
if err != nil {
return nil, err
Expand Down

0 comments on commit 3a49d97

Please sign in to comment.