-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathoutput.tf
22 lines (18 loc) · 898 Bytes
/
output.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
locals {
kubeconfig_raw = replace(ssh_sensitive_resource.kubeconfig.result, "127.0.0.1", hcloud_server.master.ipv4_address)
kubeconfig_parsed = yamldecode(local.kubeconfig_raw)
kubeconfig_data = {
host = local.kubeconfig_parsed["clusters"][0]["cluster"]["server"]
client_certificate = base64decode(local.kubeconfig_parsed["users"][0]["user"]["client-certificate-data"])
client_key = base64decode(local.kubeconfig_parsed["users"][0]["user"]["client-key-data"])
cluster_ca_certificate = base64decode(local.kubeconfig_parsed["clusters"][0]["cluster"]["certificate-authority-data"])
}
}
output "kubeconfig" {
description = "Kubeconfig in YAML format"
value = local.kubeconfig_raw
}
output "kubeconfig_data" {
description = "Kubeconfig as structured data to pass values to other provider"
value = local.kubeconfig_data
}