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

route53: adds option to use private zone #2162

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions cmd/zz_gen_cmd_dnshelp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/content/dns/zz_gen_route53.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ More information [here]({{% ref "dns#configuration-and-credentials" %}}).
|--------------------------------|-------------|
| `AWS_MAX_RETRIES` | The number of maximum returns the service will use to make an individual API request |
| `AWS_POLLING_INTERVAL` | Time between DNS propagation check |
| `AWS_PRIVATE_ZONE` | Set to true to use private zones only (default: use public zones only) |
| `AWS_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
| `AWS_SHARED_CREDENTIALS_FILE` | Managed by the AWS client. Shared credentials file. |
| `AWS_TTL` | The TTL of the TXT record used for the DNS challenge |
Expand Down
5 changes: 4 additions & 1 deletion providers/dns/route53/route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const (
EnvMaxRetries = envNamespace + "MAX_RETRIES"
EnvAssumeRoleArn = envNamespace + "ASSUME_ROLE_ARN"
EnvExternalID = envNamespace + "EXTERNAL_ID"
EnvPrivateZone = envNamespace + "PRIVATE_ZONE"

EnvWaitForRecordSetsChanged = envNamespace + "WAIT_FOR_RECORD_SETS_CHANGED"

Expand All @@ -58,6 +59,7 @@ type Config struct {
MaxRetries int
AssumeRoleArn string
ExternalID string
PrivateZone bool

WaitForRecordSetsChanged bool

Expand All @@ -75,6 +77,7 @@ func NewDefaultConfig() *Config {
MaxRetries: env.GetOrDefaultInt(EnvMaxRetries, 5),
AssumeRoleArn: env.GetOrDefaultString(EnvAssumeRoleArn, ""),
ExternalID: env.GetOrDefaultString(EnvExternalID, ""),
PrivateZone: env.GetOrDefaultBool(EnvPrivateZone, false),

WaitForRecordSetsChanged: env.GetOrDefaultBool(EnvWaitForRecordSetsChanged, true),

Expand Down Expand Up @@ -312,7 +315,7 @@ func (d *DNSProvider) getHostedZoneID(ctx context.Context, fqdn string) (string,
var hostedZoneID string
for _, hostedZone := range resp.HostedZones {
// .Name has a trailing dot
if !hostedZone.Config.PrivateZone && ptr.Deref(hostedZone.Name) == authZone {
if ptr.Deref(hostedZone.Name) == authZone && (d.config.PrivateZone && hostedZone.Config.PrivateZone || !d.config.PrivateZone && !hostedZone.Config.PrivateZone) {
hostedZoneID = ptr.Deref(hostedZone.Id)
break
}
Expand Down
1 change: 1 addition & 0 deletions providers/dns/route53/route53.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ Replace `Z11111112222222333333` with your hosted zone ID and `example.com` with
AWS_EXTERNAL_ID = "Managed by STS AssumeRole API operation (`AWS_EXTERNAL_ID_FILE` is not supported)"
AWS_WAIT_FOR_RECORD_SETS_CHANGED = "Wait for changes to be INSYNC (it can be unstable)"
[Configuration.Additional]
AWS_PRIVATE_ZONE = "Set to true to use private zones only (default: use public zones only)"
AWS_SHARED_CREDENTIALS_FILE = "Managed by the AWS client. Shared credentials file."
AWS_MAX_RETRIES = "The number of maximum returns the service will use to make an individual API request"
AWS_POLLING_INTERVAL = "Time between DNS propagation check"
Expand Down
1 change: 1 addition & 0 deletions providers/dns/route53/route53_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var envTest = tester.NewEnvTest(
EnvRegion,
EnvHostedZoneID,
EnvMaxRetries,
EnvPrivateZone,
EnvTTL,
EnvPropagationTimeout,
EnvPollingInterval,
Expand Down
Loading