-
Notifications
You must be signed in to change notification settings - Fork 6
/
outputs.tf
34 lines (33 loc) · 1.33 KB
/
outputs.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
locals {
k3s_bootstrap_manifest_b64 = var.bootstrap_token_id != null ? base64encode(
templatefile("${path.module}/cloud-init/bootstrap-token.yaml", {
token_id = var.bootstrap_token_id
token_secret = var.bootstrap_token_secret
})) : ""
}
output "user_data" {
value = templatefile("${path.module}/cloud-init/k3s.yml", {
custom_cloud_config_write_files = var.custom_cloud_config_write_files
custom_cloud_config_runcmd = var.custom_cloud_config_runcmd
ips = compact(concat([var.k3s_ip], var.k3s_ips))
external_ip = var.k3s_external_ip
persistent_volume_dev = var.persistent_volume_dev
persistent_volume_label = var.persistent_volume_label
is_server = contains(var.k3s_args, "server")
k3s_install_url = var.k3s_install_url
k3s_config = base64encode(<<-EOT
K3S_TOKEN=${var.cluster_token}
K3S_URL=${var.k3s_url}
INSTALL_K3S_EXEC="${join(" ", var.k3s_args)}"
%{if var.k3s_version != null~}
INSTALL_K3S_VERSION=${var.k3s_version}
%{else~}
INSTALL_K3S_CHANNEL=${var.k3s_channel}
%{endif~}
EOT
)
k3s_bootstrap_manifest_b64 = local.k3s_bootstrap_manifest_b64
cni_plugins_version = var.cni_plugins_version
})
sensitive = true
}