Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to specify hosted zone ID #261

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ func (p *Provider) getRecords(ctx context.Context, zoneID string, _ string) ([]l
}

func (p *Provider) getZoneID(ctx context.Context, zoneName string) (string, error) {
if p.HostedZoneID != "" {
return "/hostedzone/" + p.HostedZoneID, nil
}

getZoneInput := &r53.ListHostedZonesByNameInput{
DNSName: aws.String(zoneName),
MaxItems: aws.Int32(1),
Expand Down
7 changes: 7 additions & 0 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ type Provider struct {
// WaitForPropagation if set to true, it will wait for the record to be
// propagated before returning.
WaitForPropagation bool `json:"wait_for_propagation,omitempty"`

// HostedZoneID is the ID of the hosted zone to use. If not set, it will
// be discovered from the zone name.
//
// This option should contain only the ID; the "/hostedzone/" prefix
// will be added automatically.
HostedZoneID string `json:"hosted_zone_id,omitempty"`
}

// GetRecords lists all the records in the zone.
Expand Down
Loading