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

aws_route53_record does not support .arpa records, aka reverse DNS. #5068

Closed
vanDonselaar opened this issue Feb 9, 2016 · 3 comments
Closed

Comments

@vanDonselaar
Copy link

It is not possible to create reverse DNS records using aws_route53_record.

Minimal working example:

resource "aws_route53_zone" "my_private_zone" {
   name = "terraform.example.org"
}

resource "aws_route53_record" "reverse_record" {
  zone_id = "${aws_route53_zone.my_private_zone.id}"
  name = "1.0.168.192.in-addr.arpa"
  type = "PTR"
  ttl = "300"
  records = ["node1.terraform.example.org"]
}

Problem: this results in a DNS record that includes the zone name: 1.0.168.192.in-addr.arpa.terraform.example.org.. Trying to work around this problem by terminating the record entry with a dot doesn't work either:

1 error(s) occurred:

* aws_route53_record.reverse_record: InvalidChangeBatch: FATAL problem: DomainLabelEmpty encountered at 1.0.168.192.in-addr.arpa..terraform.example.org

This is all caused by the method expandRecordName in /builtin/providers/aws/resource_aws_route53_record.go.

I think this can be fixed by the following adjustment:

--- builtin/providers/aws/resource_aws_route53_record.go    (revision 73102aba427cc071075ad2672f7f1d0f9cb035c3)
+++ builtin/providers/aws/resource_aws_route53_record.go    (revision )
@@ -501,7 +501,7 @@
 func expandRecordName(name, zone string) string {
    rn := strings.ToLower(strings.TrimSuffix(name, "."))
    zone = strings.TrimSuffix(zone, ".")
-   if !strings.HasSuffix(rn, zone) {
+   if !strings.HasSuffix(rn, zone) && !strings.HasSuffix(rn, ".arpa") {
        rn = strings.Join([]string{name, zone}, ".")
    }
    return rn

I'm not sure if this is safe to do. This method was introduced in #1279 which fixes quite a lot of issues regarding updating of DNS records (i.e. #1126, #1264 and #1122). So this might need some more testing.

@billf
Copy link
Contributor

billf commented Feb 10, 2016

https://aws.amazon.com/premiumsupport/knowledge-center/route-53-reverse-dns/

the proper zone to put such a record in would be 0.168.192.in-addr.arpa and then you would add a PTR record for "1.0.168.192.in-addr.arpa"

@vanDonselaar
Copy link
Author

I see, my mistake. Thanks for pointing out.

@ghost
Copy link

ghost commented Apr 28, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants