-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
TF keeps recreating a '@' TXT record #3579
Comments
Hi @FransUrbo 👋 , if you're not familiar, e.g. |
I have quite a lot of experience with Bind, everything from v4 to v9. But I've never seen that kind of record before. Not that I can remember anyway. It's been a couple of years since I last work with Bind. Will that change be "the same"? I'm guessing it's for some form of domain validation and I don't want to risk breaking that with the move. |
You can verify it does the correct behavior via dig/nslookup before you flip the DNS name servers with your registrar:
That said, if you're really paranoid about the migration and want to be sure the records are created exactly the same, you may want to consider using Route 53's built in import functionality if your old registrar allows you to export in the correct format. Then you can import the records into Terraform (modifying the configuration until it shows no difference). |
Unfortunately, register.com don't offer an export function :(. I'll try it that way and just hope for the best. Worst case, we'll have to do it some other way (or revert back to register.com for those few domains). Thanx for the help. I consider this issue closed. Although, some documentation update somewhere that mention this? As in, tagging this "Documentation" (and possibly putting it at a low prio) will suffice for me. I'll leave it open for now, but feel free to close it. |
@bflad I just hit this as well so thanks for the advice and explanation! I dove into it a bit more to try and understand why the record (which is valid but not recommended) was being recreated every time. The weird thing is that terraform creates the resource but doesn't put it into the state. My test. resource "aws_route53_zone" "example_com" {
name = "elastictest.co"
}
resource "aws_route53_record" "100_example_com" {
zone_id = "${aws_route53_zone.example_com.zone_id}"
name = "@"
type = "TXT"
records = ["text1"]
ttl = "3600"
} A
When looking at the output from
I tried changing the name to match what I was getting back from AWS. resource "aws_route53_record" "100_example_com" {
zone_id = "${aws_route53_zone.example_com.zone_id}"
name = "\100.elastictest.co"
type = "TXT"
records = ["text2"]
ttl = "3600"
} However exactly the same thing happened. The correct record (@.elastictest.co) was updated but nothing was added to the terraform state. So for my use case it is fine to switch to the apex domain however this still feels like a genuine terraform bug to me. I can't imagine it is normal for terraform to successfully create a resource and not store it in the state. |
You're correct. We should be returning a log message in this case: We may need to allow the resource to convert to and from octal codes if its not doing so already. AWS Documentation
Although understandably in the |
@bflad Just to be 100% clear. The record was actually created successfully and appeared in AWS when using both So it would appear that terraform (or the AWS api) is correctly handling the octal codes. Also if I set |
Yesterday I made a switched the TXT records we had at So the side affect was that an unrelated record was deleted in the same zone. I still need to try and reproduce this all again however I wanted to document it here first since I find it quite scary. Before I made the change an unrelated change in a different zone did something weird:
The value it changed to comes from push.docker.elastictest.co which was not modified in the change (and was randomly deleted after the next run) When the change removing the @ records was deployed this resource was deleted even though up until now it had never existed in state properly. This record was removed.
In the same plan that line was added to the apex record which already included many other TXT records:
When this change was ran the @ record for elastictest.co was destroyed. Looking in the route53 cloudtrail logs I can see that this actually removed push.docker.elastictest.co
A bit of extra info: All of our changes are controlled via jenkins and I have confirmed via route53 cloudtrail that no records were modified by anything other than terraform running from jenkins. |
Created #4183 to fix the issues I found above. |
The non-alphanumeric character fix for |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
I've been tasked with moving all domains that the company owns from register.com to AWS Route53.
In a few domains, there's a TXT record named
@
. Moving those into TF and then have TF apply it leads to TF wanting to create the record each time.Terraform Version
0.11.3
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Created once and never any changes again.
Actual Behavior
TF want's to add the resource every time.
Steps to Reproduce
References
This is a screenshot from the register.com TXT record list:
This is a screenshot of the resource created in R53:
The text was updated successfully, but these errors were encountered: