forked from mysticaltech/terraform-hcloud-kube-hetzner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.tf
More file actions
178 lines (151 loc) · 5.34 KB
/
output.tf
File metadata and controls
178 lines (151 loc) · 5.34 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
output "cluster_name" {
value = var.cluster_name
description = "Shared suffix for all resources belonging to this cluster."
}
output "network_id" {
value = data.hcloud_network.k3s.id
description = "The ID of the HCloud network."
}
output "ssh_key_id" {
value = local.hcloud_ssh_key_id
description = "The ID of the HCloud SSH key."
}
output "control_planes_public_ipv4" {
value = [
for obj in module.control_planes : obj.ipv4_address
]
description = "The public IPv4 addresses of the controlplane servers."
}
output "control_planes_public_ipv6" {
value = [
for obj in module.control_planes : obj.ipv6_address
]
description = "The public IPv6 addresses of the controlplane servers."
}
output "agents_public_ipv4" {
value = [
for obj in module.agents : obj.ipv4_address
]
description = "The public IPv4 addresses of the agent servers."
}
output "agents_public_ipv6" {
value = [
for obj in module.agents : obj.ipv6_address
]
description = "The public IPv6 addresses of the agent servers."
}
output "ingress_public_ipv4" {
description = "The public IPv4 address of the Hetzner load balancer (with fallback to first control plane node)"
value = local.has_external_load_balancer ? local.first_control_plane_ip : hcloud_load_balancer.cluster[0].ipv4
}
output "ingress_public_ipv6" {
description = "The public IPv6 address of the Hetzner load balancer (with fallback to first control plane node)"
value = local.has_external_load_balancer ? module.control_planes[keys(module.control_planes)[0]].ipv6_address : (var.load_balancer_disable_ipv6 ? null : hcloud_load_balancer.cluster[0].ipv6)
}
output "lb_control_plane_ipv4" {
description = "The public IPv4 address of the Hetzner control plane load balancer"
value = one(hcloud_load_balancer.control_plane[*].ipv4)
}
output "lb_control_plane_ipv6" {
description = "The public IPv6 address of the Hetzner control plane load balancer"
value = one(hcloud_load_balancer.control_plane[*].ipv6)
}
output "k3s_endpoint" {
description = "A controller endpoint to register new nodes"
value = "https://${var.use_control_plane_lb ? hcloud_load_balancer_network.control_plane.*.ip[0] : module.control_planes[keys(module.control_planes)[0]].private_ipv4_address}:6443"
}
output "k3s_token" {
description = "The k3s token to register new nodes"
value = local.k3s_token
sensitive = true
}
output "control_plane_nodes" {
description = "The control plane nodes"
value = [for node in module.control_planes : node]
}
output "agent_nodes" {
description = "The agent nodes"
value = [for node in module.agents : node]
}
output "domain_assignments" {
description = "Assignments of domains to IPs based on reverse DNS"
value = concat(
# Propagate domain assignments from control plane and agent nodes.
flatten([
for node in concat(values(module.control_planes), values(module.agents)) :
node.domain_assignments
]),
# Get assignments from floating IPs.
[for rdns in hcloud_rdns.agents : {
domain = rdns.dns_ptr
ips = [rdns.ip_address]
}]
)
}
# Keeping for backward compatibility
output "kubeconfig_file" {
value = local.kubeconfig_external
description = "Kubeconfig file content with external IP address, or internal IP address if only private ips are available"
sensitive = true
}
output "kubeconfig" {
value = local.kubeconfig_external
description = "Kubeconfig file content with external IP address, or internal IP address if only private ips are available"
sensitive = true
}
output "kubeconfig_data" {
description = "Structured kubeconfig data to supply to other providers"
value = local.kubeconfig_data
sensitive = true
}
output "cilium_values" {
description = "Helm values.yaml used for Cilium"
value = local.cilium_values
sensitive = true
}
output "cert_manager_values" {
description = "Helm values.yaml used for cert-manager"
value = local.cert_manager_values
sensitive = true
}
output "csi_driver_smb_values" {
description = "Helm values.yaml used for SMB CSI driver"
value = local.csi_driver_smb_values
sensitive = true
}
output "longhorn_values" {
description = "Helm values.yaml used for Longhorn"
value = local.longhorn_values
sensitive = true
}
output "traefik_values" {
description = "Helm values.yaml used for Traefik"
value = local.traefik_values
sensitive = true
}
output "nginx_values" {
description = "Helm values.yaml used for nginx-ingress"
value = local.nginx_values
sensitive = true
}
output "haproxy_values" {
description = "Helm values.yaml used for HAProxy"
value = local.haproxy_values
sensitive = true
}
output "nat_router_public_ipv4" {
description = "The address of the nat router, if it exists."
value = try(hcloud_server.nat_router[0].ipv4_address, null)
}
output "nat_router_public_ipv6" {
description = "The address of the nat router, if it exists."
value = try(hcloud_server.nat_router[0].ipv6_address, null)
}
output "nat_router_username" {
description = "The non-root user as which you can ssh into the router."
value = "nat-router" # hard-coded in cloud-init template.
}
output "nat_router_ssh_port" {
description = "The non-root user as which you can ssh into the router."
value = var.ssh_port
}