Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- variable "zone_id {
- type = string
- }
- variable "primary_fqdn" {
- type = string
- }
- variable "secondary_fqdn" {
- type = string
- }
- variable "failover_fqdn" {
- type = string
- }
- variable "healthcheck_port" {
- type = string
- }
- resource "aws_route53_record" "primary_a_record" {
- zone_id = "${var.zone_id}"
- name = "${var.failover_fqdn}"
- type = "A"
- alias {
- name = "${var.primary_fqdn}"
- zone_id = "${var.zone_id}"
- evaluate_target_health = "true"
- }
- set_identifier = "${var.failover_fqdn}-primary"
- health_check_id = "${aws_route53_health_check.failover_healthcheck.id}"
- failover_routing_policy {
- type = "PRIMARY"
- }
- }
- resource "aws_route53_record" "secondary_a_record" {
- zone_id = "${var.zone_id}"
- name = "${var.failover_fqdn}"
- type = "A"
- alias {
- name = "${var.secondary_fqdn}"
- zone_id = "${var.zone_id}"
- evaluate_target_health = "true"
- }
- set_identifier = "${var.failover_fqdn}-secondary"
- failover_routing_policy {
- type = "SECONDARY"
- }
- }
- resource "aws_route53_health_check" "failover_healthcheck" {
- fqdn = "${var.failover_fqdn}"
- port = "${var.healthcheck_port}"
- type = "TCP"
- failure_threshold = "2"
- request_interval = "5"
- tags {
- Name = "failover-healthcheck"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement