khuedoan-homelab/platform/main.tf

43 lines
740 B
Terraform
Raw Normal View History

2020-11-04 22:46:38 +07:00
provider "rke" {
debug = true
}
resource rke_cluster "cluster" {
dynamic "nodes" {
for_each = [
2020-11-05 01:00:12 +07:00
"192.168.1.21",
2020-11-04 22:46:38 +07:00
"192.168.1.22",
"192.168.1.23"
]
content {
address = nodes.value
user = "root"
role = [
2020-11-05 01:09:18 +07:00
"controlplane",
"etcd",
"worker"
]
ssh_key = file("~/.ssh/id_rsa")
}
}
dynamic "nodes" {
for_each = [
"192.168.1.17"
]
content {
address = nodes.value
user = "root"
role = [
"worker"
2020-11-04 22:46:38 +07:00
]
ssh_key = file("~/.ssh/id_rsa")
}
}
}
2020-11-05 01:09:18 +07:00
resource "local_file" "kube_config_yaml" {
filename = "${path.root}/kube_config.yaml"
2020-11-04 22:46:38 +07:00
content = rke_cluster.cluster.kube_config_yaml
2020-10-28 23:30:16 +07:00
}