Advertisement
Guest User

Untitled

a guest
May 27th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. variable "zone_id {
  2. type = string
  3. }
  4. variable "primary_fqdn" {
  5. type = string
  6. }
  7. variable "secondary_fqdn" {
  8. type = string
  9. }
  10. variable "failover_fqdn" {
  11. type = string
  12. }
  13. variable "healthcheck_port" {
  14. type = string
  15. }
  16.  
  17.  
  18.  
  19. resource "aws_route53_record" "primary_a_record" {
  20. zone_id = "${var.zone_id}"
  21. name = "${var.failover_fqdn}"
  22. type = "A"
  23.  
  24. alias {
  25. name = "${var.primary_fqdn}"
  26. zone_id = "${var.zone_id}"
  27. evaluate_target_health = "true"
  28. }
  29.  
  30. set_identifier = "${var.failover_fqdn}-primary"
  31. health_check_id = "${aws_route53_health_check.failover_healthcheck.id}"
  32.  
  33. failover_routing_policy {
  34. type = "PRIMARY"
  35. }
  36. }
  37.  
  38. resource "aws_route53_record" "secondary_a_record" {
  39. zone_id = "${var.zone_id}"
  40. name = "${var.failover_fqdn}"
  41. type = "A"
  42.  
  43. alias {
  44. name = "${var.secondary_fqdn}"
  45. zone_id = "${var.zone_id}"
  46. evaluate_target_health = "true"
  47. }
  48.  
  49. set_identifier = "${var.failover_fqdn}-secondary"
  50.  
  51. failover_routing_policy {
  52. type = "SECONDARY"
  53. }
  54. }
  55.  
  56.  
  57. resource "aws_route53_health_check" "failover_healthcheck" {
  58. fqdn = "${var.failover_fqdn}"
  59. port = "${var.healthcheck_port}"
  60. type = "TCP"
  61. failure_threshold = "2"
  62. request_interval = "5"
  63.  
  64. tags {
  65. Name = "failover-healthcheck"
  66. }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement