This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
controlplane.tf
137 lines (119 loc) · 3.32 KB
/
controlplane.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
resource "hcloud_placement_group" "control_plane_placement" {
name = "api placement"
type = "spread"
labels = {
"cluster" = var.cluster_name
"role" = "api"
}
}
resource "hcloud_server" "control_plane1" {
name = "api1.${var.dns_domain}"
server_type = var.control_plane_type
image = var.image
location = var.datacenter
placement_group_id = hcloud_placement_group.control_plane_placement.id
ssh_keys = [
hcloud_ssh_key.cedi_ivy.name,
hcloud_ssh_key.cedi_mae.name,
hcloud_ssh_key.ghaction.name
]
labels = {
"cluster" = var.cluster_name
"role" = "api"
}
}
resource "cloudflare_record" "dns_v4_api1" {
zone_id = var.cloudflare_zone_id
name = "api1"
value = hcloud_server.control_plane1.ipv4_address
type = "A"
ttl = 1
proxied = false
}
resource "cloudflare_record" "dns_v6_api1" {
zone_id = var.cloudflare_zone_id
name = "api1"
value = hcloud_server.control_plane1.ipv6_address
type = "AAAA"
ttl = 1
proxied = false
}
resource "hcloud_rdns" "rdns_api1" {
server_id = hcloud_server.control_plane1.id
ip_address = hcloud_server.control_plane1.ipv4_address
dns_ptr = "api1.${var.dns_domain}"
}
resource "hcloud_server" "control_plane2" {
name = "api2.${var.dns_domain}"
server_type = var.control_plane_type
image = var.image
location = var.datacenter
placement_group_id = hcloud_placement_group.control_plane_placement.id
ssh_keys = [
hcloud_ssh_key.cedi_ivy.name,
hcloud_ssh_key.cedi_mae.name,
hcloud_ssh_key.ghaction.name
]
labels = {
"cluster" = var.cluster_name
"role" = "api"
}
}
resource "cloudflare_record" "dns_v4_api2" {
zone_id = var.cloudflare_zone_id
name = "api2"
value = hcloud_server.control_plane2.ipv4_address
type = "A"
ttl = 1
proxied = false
}
resource "cloudflare_record" "dns_v6_api2" {
zone_id = var.cloudflare_zone_id
name = "api2"
value = hcloud_server.control_plane2.ipv6_address
type = "AAAA"
ttl = 1
proxied = false
}
resource "hcloud_rdns" "rdns_api2" {
server_id = hcloud_server.control_plane2.id
ip_address = hcloud_server.control_plane2.ipv4_address
dns_ptr = "api2.${var.dns_domain}"
}
resource "hcloud_server" "control_plane3" {
name = "api3.${var.dns_domain}"
server_type = var.control_plane_type
image = var.image
location = var.datacenter
placement_group_id = hcloud_placement_group.control_plane_placement.id
ssh_keys = [
hcloud_ssh_key.cedi_ivy.name,
hcloud_ssh_key.cedi_mae.name,
hcloud_ssh_key.ghaction.name
]
labels = {
"cluster" = var.cluster_name
"role" = "api"
}
}
resource "cloudflare_record" "dns_v4_api3" {
zone_id = var.cloudflare_zone_id
name = "api3"
value = hcloud_server.control_plane3.ipv4_address
type = "A"
ttl = 1
proxied = false
}
resource "cloudflare_record" "dns_v6_api3" {
zone_id = var.cloudflare_zone_id
name = "api3"
value = hcloud_server.control_plane3.ipv6_address
type = "AAAA"
ttl = 1
proxied = false
}
resource "hcloud_rdns" "rdns_api3" {
server_id = hcloud_server.control_plane3.id
ip_address = hcloud_server.control_plane3.ipv4_address
dns_ptr = "api3.${var.dns_domain}"
}