-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.tf
59 lines (52 loc) · 1.77 KB
/
dns.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# create DNS zone with names for cluster resources
resource "yandex_dns_zone" "dns-zone-yc" {
name = "dns-zone-yc"
zone = "${local.dns_zone}."
public = true
}
resource "yandex_dns_recordset" "dns-record-kube-cluster-control" {
zone_id = yandex_dns_zone.dns-zone-yc.id
name = local.cluster_name
type = "A"
ttl = 200
data = yandex_compute_instance.kube_control_plane.*.network_interface.0.nat_ip_address
depends_on = [yandex_compute_instance.kube_control_plane]
}
# as we use ingress controller with hostNetwork mode, we assign to ingress name IP of all worker nodes
resource "yandex_dns_recordset" "dns-record-kube-cluster-ingress" {
zone_id = yandex_dns_zone.dns-zone-yc.id
name = "${local.cluster_name}-ingress"
type = "A"
ttl = 200
data = yandex_compute_instance.kube_node.*.network_interface.0.nat_ip_address
depends_on = [yandex_compute_instance.kube_node]
}
# following names just CNAME for ingress
resource "yandex_dns_recordset" "dns-record-kube-cluster-dashboard" {
zone_id = yandex_dns_zone.dns-zone-yc.id
name = "${local.cluster_name}-dashboard"
type = "CNAME"
ttl = 200
data = [local.ingress_url]
}
resource "yandex_dns_recordset" "dns-record-grafana" {
zone_id = yandex_dns_zone.dns-zone-yc.id
name = "grafana"
type = "CNAME"
ttl = 200
data = [local.ingress_url]
}
resource "yandex_dns_recordset" "dns-record-testapp" {
zone_id = yandex_dns_zone.dns-zone-yc.id
name = "testapp"
type = "CNAME"
ttl = 200
data = [local.ingress_url]
}
resource "yandex_dns_recordset" "dns-record-testapp-stage" {
zone_id = yandex_dns_zone.dns-zone-yc.id
name = "testapp-stage"
type = "CNAME"
ttl = 200
data = [local.ingress_url]
}