-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws: add support for geolocation and latency records to route53 #2981
Conversation
4be6acc
to
5b9a037
Compare
👍 |
@@ -94,6 +94,35 @@ func resourceAwsRoute53Record() *schema.Resource { | |||
Optional: true, | |||
}, | |||
|
|||
"region": &schema.Schema{ // AWS region from which to evaluate latency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usual convention is to have the Terraform properties match with the AWS API or UI labels for things, but this name seems rather confusing and I think you agree since you put a comment on it trying to elaborate. 😀
Perhaps this should be called latency_routing_region
. My intent with this name is to indicate that we're giving the region that will be used for latency routing, and not (as would normally be the case where "region" is used elsewhere in Terraform) where this record resource will be hosted.
Alternatively, riffing off how this is arranged in the Route53 UI, I might consider having a routing_policy
child block that contains all of these routing policy options. This is similar to how it's placed in a separate box in the Route53 console, distinct from the TTL and value.
resource "aws_route53_record" "foo" {
zone_id = "${aws_route53_zone.primary.zone_id}"
name = "www.example.com"
type = "A"
ttl = "300"
records = ["${aws_eip.lb.public_ip}"]
routing_policy {
region = "us-west-2"
}
}
Then at least it's a bit clearer that this region is routing-related. Your other set of mutually-exclusive fields
That last alternative still misses the "routing policy" field from the UI where you choose a type of routing, indicating that this is latency-based routing, so maybe this is better:
resource "aws_route53_record" "foo" {
zone_id = "${aws_route53_zone.primary.zone_id}"
name = "www.example.com"
type = "A"
ttl = "300"
records = ["${aws_eip.lb.public_ip}"]
latency_routing_policy {
region = "us-west-2"
}
}
...and then there could be other mutually-exclusive child blocks for weighted_routing_policy
, failover_routing_policy
and geolocation_routing_policy
, each containing the set of fields that gets displayed when you select the corresponding option for routing policy in the Route53 console.
Not sure which of these options I like the best. I think I lean towards the latter since I think it's most user-friendly to prefer to mimic the AWS UI rather than the API when they are in conflict, but YMMV.
Looking forward to having these features available in Terraform! Thanks for doing this. If you've got the time it'd be nice to also update the website docs for this resource, which you can find in |
5b9a037
to
79abe7b
Compare
I agree with @apparentlymart regarding the naming of the |
+1 Thanks for putting this up, keen to see it in.. as Ill be needing this feature very soon |
*bump .. any movement on this @acm1 ? ... Thanks |
I'll take a look at getting @apparentlymart's suggestions into the PR this week. |
Awesome, thanks @acm1 |
Looking forward for this one to be merged |
Hey @acm1 any chance you're still working on this? |
Another follow up here, sorry... These additions look very promising and there seems to be good desire from the community to have, so thank you for the start! In order to merge this PR I'd like to see the following:
If you have questions on how to convert to the block style, let us know! You should be able to use Route53's For acceptance tests, you can probably use the same For documentation, look in the Let us know if you have other questions! |
This one got away from me. I'll dig into it this week -- thanks for the guidance @catsby. |
Great to hear @acm1 , thanks! Let me know if you have questions |
04b45e1
to
b8d0cec
Compare
@catsby I've pushed changes to implement @apparentlymart's suggested block style along with acceptance tests and documentation. Let me know what you think. |
Has this been released, yet? |
@TheLinuxNinja no. I recently refactored Route53 Records internals a bit so this will need a rebase (sorry about that, but it was necessary) Let me know if you (@acm1) will be able to do that, thanks! |
045adda
to
bf2d67c
Compare
@catsby I've rebased. |
excellent, thanks! the Travis error is a thing being worked out, so I should merge this early next week |
Besides my code comment above, I was thinking maybe it makes more sense to put
vs.
Thoughts? |
When this is going to be merged? |
Hey all – I'm re-reviewing this now/today. I need to think on some things as this will introduce a backwards incompatibility regarding weighted records that we already have. @acm1 regarding the |
"weight": &schema.Schema{ | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking I should leave this line in so that terraform doesn't try to modify every route53 resource already on record since the default value changes from -1 to 0 if this line is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can address this in a migration, e.g:
We'll need to do that for all -1
entries.
Any news on this front? |
I think a lot of people needs this feature! |
+1 |
b542278
to
bb96b49
Compare
@catsby I've reworked this a bit and addressed your comments by adding a state migration and checking for errors when setting existing values. Thoughts? |
bb96b49
to
96cb98d
Compare
96cb98d
to
f5d4373
Compare
…route53 provider/aws: Geolocation and Latency for Route53 Records (supersedes #2981)
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. |
This should fulfill the feature request in #2746.