infrastructure/k8s.tjo.cloud/main.tf

117 lines
2.3 KiB
Terraform
Raw Normal View History

module "cluster" {
2024-07-27 14:08:21 +00:00
source = "./modules/cluster"
providers = {
helm.template = helm.template
}
talos = {
2024-12-19 21:15:46 +00:00
version = "v1.9.0"
kubernetes = "v1.32.0"
}
cluster = {
2024-08-02 20:10:21 +00:00
name = "k8s-tjo-cloud"
oidc = {
client_id = var.oidc_client_id
issuer_url = var.oidc_issuer_url
}
2024-12-15 17:35:26 +00:00
pod_cidr = {
2024-12-22 12:32:22 +00:00
ipv4 = "10.0.240.0/22"
ipv6 = "fd74:6a6f:0:f000::/54"
2024-12-15 17:35:26 +00:00
}
service_cidr = {
2024-12-22 12:32:22 +00:00
ipv4 = "10.0.244.0/22"
ipv6 = "fd74:6a6f:0:f400::/108"
}
load_balancer_cidr = {
2024-12-15 17:35:26 +00:00
ipv4 = "10.0.248.0/22"
2024-12-22 12:32:22 +00:00
ipv6 = "fd74:6a6f:0:f800::/54"
2024-12-15 17:35:26 +00:00
}
}
proxmox = {
name = "tjo-cloud"
url = "https://proxmox.tjo.cloud/api2/json"
common_storage = "synology.storage.tjo.cloud"
}
2024-12-15 17:35:26 +00:00
hosts = {
nevaroo = {
asn = 65003
}
mustafar = {
asn = 65004
}
}
nodes = {
2024-12-15 17:35:26 +00:00
nevaroo-1 = {
2024-12-14 19:15:07 +00:00
id = 6001
2024-07-19 20:48:07 +00:00
type = "controlplane"
host = "nevaroo"
storage = "local-nvme-lvm"
2024-07-19 20:48:07 +00:00
cores = 4
memory = 4096
}
2024-12-22 12:32:22 +00:00
nevaroo-2 = {
id = 6003
type = "worker"
host = "nevaroo"
storage = "local-nvme-lvm"
cores = 4
memory = 4096
}
2024-12-30 19:44:57 +00:00
mustafar-3 = {
id = 6005
2024-12-22 12:32:22 +00:00
type = "controlplane"
host = "mustafar"
storage = "local"
cores = 4
memory = 4096
}
mustafar-2 = {
id = 6002
2024-07-19 20:48:07 +00:00
type = "worker"
host = "mustafar"
storage = "local"
2024-12-19 21:15:46 +00:00
cores = 4
memory = 4096
}
}
}
resource "local_file" "kubeconfig" {
2024-08-04 17:50:50 +00:00
content = templatefile("${path.module}/kubeconfig.tftpl", {
cluster : {
name : module.cluster.name,
2024-12-14 19:15:07 +00:00
endpoint : module.cluster.api.internal.endpoint,
2024-08-04 17:50:50 +00:00
ca : module.cluster.api.ca,
}
oidc : {
issuer : var.oidc_issuer_url,
id : var.oidc_client_id,
}
})
filename = "${path.module}/kubeconfig"
}
2024-07-23 18:42:22 +00:00
module "cluster-core" {
2024-07-27 14:08:21 +00:00
source = "./modules/cluster-core"
cluster_name = module.cluster.name
2024-07-23 18:42:22 +00:00
}
module "cluster-components" {
2024-07-27 14:08:21 +00:00
source = "./modules/cluster-components"
2024-07-20 11:09:30 +00:00
oidc_issuer_url = var.oidc_issuer_url
oidc_client_id = var.oidc_client_id
2025-01-03 18:27:34 +00:00
dnsimple_token = var.dnsimple_token
dnsimple_account_id = "155200"
2024-07-20 11:09:30 +00:00
cluster_name = module.cluster.name
2024-08-02 20:10:21 +00:00
cluster_domain = "k8s.tjo.cloud"
}