-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ROUTE53: Support Route53's ALIAS record type (#239) #301
ROUTE53: Support Route53's ALIAS record type (#239) #301
Conversation
Wow! I'm so happy that you took the time to write R53_ALIAS! People have been asking for this for ages but we (stackoverflow) don't use AWS so we don't have the knowledge of how to implement it. I've made a couple very small comments. Please also add this to the feature matrix (ontrol/build/generate/featureMatrix.g) (The need to add that was only recently documented 79983f3) Thanks! |
dec6915
to
2736a2b
Compare
@tlimoncelli I've pushed a new version of the PR containing the |
I guess I should have merged them in the other order. :-( Could you rebase, "go generate" and check it in? |
Iterating over a map in Go never produces twice the same ordering. Thus when comparing two metadata map with more than one key, the `differ` is always finding differences. To properly compare records metadata, we need to iterate the maps in a deterministic way. Signed-off-by: Brice Figureau <brice@daysofwonder.com>
Route53 ALIAS doesn't behave like a regular ALIAS, and is much more limited as its target can only be some specific AWS resources or another record in the same zone. According to StackExchange#239, this change adds a new directive R53_ALIAS which implements this specific alias. This record type can only be used with the Route53 provider. This directive usage looks like this: ```js D("example.com", REGISTRAR, DnsProvider("ROUTE53"), R53_ALIAS("foo1", "A", "bar") // record in same zone R53_ALIAS("foo2", "A", "blahblah.elasticloadbalancing.us-west-1.amazonaws.com", R53_ZONE('Z368ELLRRE2KJ0')) // ELB in us-west-1 ``` Unfortunately, Route53 requires indicating the hosted zone id where the target is defined (those are listed in AWS documentation, see the R53_ALIAS documentation for links).
2736a2b
to
ff4073d
Compare
I don't think it was possible to merge both without a conflict as both PRs touched Anyway, I've just pushed a rebased version (including generation of Thanks! |
…ckExchange#301) * Stable comparison of metadata (StackExchange#239) Iterating over a map in Go never produces twice the same ordering. Thus when comparing two metadata map with more than one key, the `differ` is always finding differences. To properly compare records metadata, we need to iterate the maps in a deterministic way. Signed-off-by: Brice Figureau <brice@daysofwonder.com> * Support for Route53 ALIAS record type (StackExchange#239) Route53 ALIAS doesn't behave like a regular ALIAS, and is much more limited as its target can only be some specific AWS resources or another record in the same zone. According to StackExchange#239, this change adds a new directive R53_ALIAS which implements this specific alias. This record type can only be used with the Route53 provider. This directive usage looks like this: ```js D("example.com", REGISTRAR, DnsProvider("ROUTE53"), R53_ALIAS("foo1", "A", "bar") // record in same zone R53_ALIAS("foo2", "A", "blahblah.elasticloadbalancing.us-west-1.amazonaws.com", R53_ZONE('Z368ELLRRE2KJ0')) // ELB in us-west-1 ``` Unfortunately, Route53 requires indicating the hosted zone id where the target is defined (those are listed in AWS documentation, see the R53_ALIAS documentation for links).
This PR implements the Route53 version of the ALIAS record type.
Route53 ALIAS doesn't behave like a regular ALIAS, and is much more limited as its target can only be some specific AWS resources (ELB, S3 buckets, CloudFront distributions, etc...) or another record in the same zone.
According to #239, this change adds a new directive R53_ALIAS which implements this specific alias. This record type can only be used with the Route53 provider.
This directive usage looks like this:
Unfortunately, Route53 API requires indicating the hosted zone id where the target is defined (those are listed in AWS documentation, see the R53_ALIAS documentation for links).
Theoretically it can be auto-discovered by looking at the target dns name in which the region and type of AWS resource can be inferred, and then lookup in a static map. Or we can use the AWS API to find the proper resource and get its hosted zone id, which unfortunately would require more permissions (and in this case the user would need to specify the resource id as target instead of the dns name which might not be very practical).
I thought it was kind of complicated so I resorted to the simple solution of letting the user indicate the zone id. The easy case is when referring to another record in the same zone, as we know already know the zone id, in which case it is not necessary to specify the zone id (that's the reason of the
R53_ZONE
modifier instead of a required parameters of theR53_ALIAS
directive).Note that unlike the regular ALIAS, the R53_ALIAS requires indicating the type of the resource, which can vary depending on the target. For a target pointing to another record in the same zone, it should be this record type, but for other it should either be a A or AAAA.
Please review, I'm fully open to suggestions and fixes.