-
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
aws_route53_zone should not sort its name_servers list #21965
Comments
I hit this today, also when trying to set up SOA records programmatically. The sorting is unfortunate, but removing it might cause a lot of unwanted changes in existing configs. Maybe a |
Looks like there isn't any sorting happening for the Not ideal as it's another Route 53 API call. And curious that there is different logic across the data source and the resource. |
I can confirm the follow is a workaround if you're looking to set the SOA record for example: # This works around the sorting applied to the list of name server by the AWS
# Terraform provider in the `aws_route53_zone` resource. No sorting is applied
# to the list in the data source.
data "aws_route53_zone" "zone" {
name = "${aws_route53_zone.zone.name}."
}
resource "aws_route53_record" "soa" {
zone_id = aws_route53_zone.zone.zone_id
name = aws_route53_zone.zone.name
type = "SOA"
ttl = 900
# See https://www.cloudflare.com/en-gb/learning/dns/dns-records/dns-soa-record/ for more information about SOA records.
records = [
"${data.aws_route53_zone.zone.name_servers[0]}. username.exampe.com. 1 7200 900 1209600 60",
]
} |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Expected Behavior
This issue is basically a copy of #3447
I'd like to manage the Route 53 SOA record in Terraform, in order to control the negative caching TTL.
The following record would seem to work, except that name_servers[0] is not the primary name server that AWS chooses by default, because the order of name_servers is not preserved by Terraform.
It appears that Terraform sorts the list. Is there a good reason for this? I wouldn't expect AWS to start reordering these arbitrarily.
Actual Behavior
Nameserver output is sorted
References
aws route53 get-hosted-zone --id ...
output is different thanThe text was updated successfully, but these errors were encountered: