Skip to content

feat!: Add support for geoproximity routing policy. Upgraded TF version to 1.3.2 #105

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,30 @@ module "records" {
continent = "EU"
}
},
{
name = "geoproximity-aws-region"
type = "CNAME"
ttl = 5
records = ["us-east-1.test.example.com."]
set_identifier = "us-east-1-region"
geoproximity_routing_policy = {
aws_region = "us-east-1"
bias = 0
}
},
{
name = "geoproximity-coordinates"
type = "CNAME"
ttl = 5
records = ["nyc.test.example.com."]
set_identifier = "nyc"
geoproximity_routing_policy = {
coordinates = {
latitude = "40.7128"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Value 40.7128 produced an error:

│ Error: creating Route53 Record: operation error Route 53: ChangeResourceRecordSets, https response error StatusCode: 400, RequestID: 54c0a63c-e5b4-4fda-864b-a10e3cc928a7, InvalidInput: Invalid XML ; javax.xml.stream.XMLStreamException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 237; cvc-pattern-valid: Value '40.7128' is not facet-valid with respect to pattern '[-+]?(90|[0-8]{0,1}[0-9](\.[0-9]{0,2})?)' for type 'Latitude'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm odd, it worked for me locally when I tested. Thank you for catching and fixing it!

longitude = "-74.0060"
}
}
},
{
name = "cloudfront"
type = "A"
Expand Down
18 changes: 18 additions & 0 deletions modules/records/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,22 @@ resource "aws_route53_record" "this" {
subdivision = lookup(each.value.geolocation_routing_policy, "subdivision", null)
}
}

dynamic "geoproximity_routing_policy" {
for_each = length(keys(lookup(each.value, "geoproximity_routing_policy", {}))) == 0 ? [] : [true]

content {
aws_region = lookup(each.value.geoproximity_routing_policy, "aws_region", null)
bias = lookup(each.value.geoproximity_routing_policy, "bias", null)
local_zone_group = lookup(each.value.geoproximity_routing_policy, "local_zone_group", null)
dynamic "coordinates" {
for_each = lookup(each.value.geoproximity_routing_policy, "coordinates", null) == null ? [] : [lookup(each.value.geoproximity_routing_policy, "coordinates", null)]

content {
latitude = coordinates.value.latitude
longitude = coordinates.value.longitude
}
}
}
}
}
Loading