Commit 426d1dc5 authored by Anna's avatar Anna Committed by GitHub

feat: Add geo routing policy and multivalue answer routing policy (#52)

parent de95912e
...@@ -64,6 +64,16 @@ module "records" { ...@@ -64,6 +64,16 @@ module "records" {
zone_id = module.s3_bucket.s3_bucket_hosted_zone_id zone_id = module.s3_bucket.s3_bucket_hosted_zone_id
} }
}, },
{
name = "geo"
type = "CNAME"
ttl = 5
records = ["europe.test.example.com."]
set_identifier = "europe"
geolocation_routing_policy = {
continent = "EU"
}
},
{ {
name = "cloudfront" name = "cloudfront"
type = "A" type = "A"
...@@ -118,11 +128,11 @@ module "records" { ...@@ -118,11 +128,11 @@ module "records" {
} }
}, },
{ {
name = "alternative-resource-name" name = "alternative-resource-name"
type = "A" type = "A"
set_identifier = "alternative-resource-name"
alias = { alias = {
name = module.s3_bucket.s3_bucket_website_domain name = module.s3_bucket.s3_bucket_website_domain
zone_id = module.s3_bucket.s3_bucket_hosted_zone_id
} }
} }
] ]
......
...@@ -20,13 +20,14 @@ resource "aws_route53_record" "this" { ...@@ -20,13 +20,14 @@ resource "aws_route53_record" "this" {
zone_id = data.aws_route53_zone.this[0].zone_id zone_id = data.aws_route53_zone.this[0].zone_id
name = each.value.name != "" ? "${each.value.name}.${data.aws_route53_zone.this[0].name}" : data.aws_route53_zone.this[0].name name = each.value.name != "" ? "${each.value.name}.${data.aws_route53_zone.this[0].name}" : data.aws_route53_zone.this[0].name
type = each.value.type type = each.value.type
allow_overwrite = lookup(each.value, "allow_overwrite", false) ttl = lookup(each.value, "ttl", null)
ttl = lookup(each.value, "ttl", null) records = lookup(each.value, "records", null)
records = lookup(each.value, "records", null) set_identifier = lookup(each.value, "set_identifier", null)
set_identifier = lookup(each.value, "set_identifier", null) health_check_id = lookup(each.value, "health_check_id", null)
health_check_id = lookup(each.value, "health_check_id", null) multivalue_answer_routing_policy = lookup(each.value, "multivalue_answer_routing_policy", null)
allow_overwrite = lookup(each.value, "allow_overwrite", false)
dynamic "alias" { dynamic "alias" {
for_each = length(keys(lookup(each.value, "alias", {}))) == 0 ? [] : [true] for_each = length(keys(lookup(each.value, "alias", {}))) == 0 ? [] : [true]
...@@ -53,4 +54,14 @@ resource "aws_route53_record" "this" { ...@@ -53,4 +54,14 @@ resource "aws_route53_record" "this" {
weight = each.value.weighted_routing_policy.weight weight = each.value.weighted_routing_policy.weight
} }
} }
dynamic "geolocation_routing_policy" {
for_each = length(keys(lookup(each.value, "geolocation_routing_policy", {}))) == 0 ? [] : [true]
content {
continent = lookup(each.value.geolocation_routing_policy, "continent", null)
country = lookup(each.value.geolocation_routing_policy, "country", null)
subdivision = lookup(each.value.geolocation_routing_policy, "subdivision", null)
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment