Traffic Policies are groups of rules and endpoints expressed as a single document that create multiple Resource Record Sets. Traffic Policies are reusable and are attached to Hosted Zones using Traffic Policy Instances. Traffic Policies are immutable and automatically versioned.
aws_route53_traffic_policy
aws_route53_traffic_policy_document
aws_route53_traffic_policy_instance
data "aws_route53_traffic_policy_document" "example" {
record_type = "A"
start_rule = "site_switch"
endpoint {
id = "my_elb"
type = "elastic-load-balancer"
value = "elb-111111.us-east-1.elb.amazonaws.com"
}
endpoint {
id = "site_down_banner"
type = "s3-website"
region = "us-east-1"
value = "www.example.com"
}
rule {
id = "site_switch"
type = "failover"
primary = {
endpoint_reference = "my_elb"
}
secondary = {
endpoint_reference = "site_down_banner"
}
}
}
resource "aws_route53_zone" "main" {
name = "test.com"
}
resource "aws_route53_traffic_policy" "www" {
name = "www"
document = "${data.aws_route53_traffic_policy_document.example.json}"
}
resource "aws_route53_traffic_policy_instance" "www_main" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "${aws_route53_traffic_policy.www.name}_${aws_route53_zone.main.name}"
policy_id = "${aws_route53_traffic_policy.www.id}"
policy_version = "${aws_route53_traffic_policy.www.version}"
}
/cc @thetwoj
Hi! are there any plans on implementing this?
thanks
Hi. I started to work on aws_route53_traffic_policy
, but cannot provide any date when will be ready (not much time I can spend on this).
Sidenote: I hit an issue with GetTrafficPolicy - it returns data even for deleted traffic policies - I asked AWS support if it's expected behavior and waiting for a reply (I know I can use ListTrafficPolicies and iterate to check but I prefer to make it clear which one should be used and why)
Most helpful comment
Hi! are there any plans on implementing this?
thanks