use yamlencode for k3s configs...
...and remove the now, hopefully unneeded workaround for agent.conf, all values are in config.yaml now
This commit is contained in:
26
agents.tf
26
agents.tf
@@ -59,27 +59,15 @@ resource "hcloud_server" "agents" {
|
||||
EOT
|
||||
}
|
||||
|
||||
# Generating and uploading the angent.conf file
|
||||
provisioner "file" {
|
||||
content = templatefile("${path.module}/templates/agent.conf.tpl", {
|
||||
server_url = "https://${local.first_control_plane_network_ip}:6443"
|
||||
node_token = random_password.k3s_token.result
|
||||
})
|
||||
destination = "/etc/rancher/k3s/agent.conf"
|
||||
|
||||
connection {
|
||||
user = "root"
|
||||
private_key = local.ssh_private_key
|
||||
agent_identity = local.ssh_identity
|
||||
host = self.ipv4_address
|
||||
}
|
||||
}
|
||||
|
||||
# Generating k3s server config file
|
||||
provisioner "file" {
|
||||
content = templatefile("${path.module}/templates/agent_config.yaml.tpl", {
|
||||
node_ip = cidrhost(hcloud_network.k3s.ip_range, 2 + var.servers_num + count.index)
|
||||
node_name = self.name
|
||||
content = yamlencode({
|
||||
node-name = self.name
|
||||
server = "https://${local.first_control_plane_network_ip}:6443"
|
||||
kubelet-arg = "cloud-provider=external"
|
||||
flannel-iface = "eth1"
|
||||
node-ip = local.first_control_plane_network_ip
|
||||
token = random_password.k3s_token.result
|
||||
})
|
||||
destination = "/etc/rancher/k3s/config.yaml"
|
||||
|
||||
|
Reference in New Issue
Block a user