-
Notifications
You must be signed in to change notification settings - Fork 10
/
route53.tf
36 lines (29 loc) · 1.05 KB
/
route53.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Copyright (C) 2018-2019 Expedia Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
resource "aws_route53_zone" "waggledance" {
count = var.wd_instance_type == "k8s" || var.enable_autoscaling ? 1 : 0
name = "${local.instance_alias}-${var.aws_region}.${var.domain_extension}"
vpc {
vpc_id = var.vpc_id
}
lifecycle {
ignore_changes = [vpc]
}
}
resource "aws_route53_record" "metastore_proxy" {
count = var.wd_instance_type == "k8s" || var.enable_autoscaling ? 1 : 0
name = "metastore-proxy"
zone_id = aws_route53_zone.waggledance[0].id
type = "CNAME"
ttl = "300"
records = var.wd_instance_type == "k8s" ? kubernetes_service.waggle_dance[0].status.0.load_balancer.0.ingress.*.hostname : [aws_lb.waggledance[0].dns_name]
}
resource "aws_route53_zone_association" "waggledance_secondary_vpc" {
count = var.enable_autoscaling ? length(var.secondary_vpcs) : 0
zone_id = aws_route53_zone.waggledance[0].id
vpc_id = var.secondary_vpcs[count.index]
vpc_region = var.aws_region
}