infrastructure/k8s.tjo.cloud/main.tf

100 lines
2 KiB
Terraform
Raw Normal View History

2024-08-02 20:10:21 +00:00
locals {
cluster_domain = "k8s.tjo.cloud"
}
module "cluster" {
2024-07-27 14:08:21 +00:00
source = "./modules/cluster"
providers = {
helm.template = helm.template
}
talos = {
version = "v1.8.3"
kubernetes = "v1.31.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
}
}
proxmox = {
name = "tjo-cloud"
url = "https://proxmox.tjo.cloud/api2/json"
common_storage = "synology.storage.tjo.cloud"
}
nodes = {
pink = {
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
pod_cidr = {
ipv4 = "10.0.56.0/20"
ipv6 = "fd74:6a6f:0:3800::/52"
}
}
blue = {
2024-07-19 20:48:07 +00:00
type = "worker"
host = "nevaroo"
storage = "local-nvme-lvm"
cores = 8
memory = 24576
pod_cidr = {
ipv4 = "10.0.52.0/20"
ipv6 = "fd74:6a6f:0:3400::/52"
}
}
cyan = {
2024-07-19 20:48:07 +00:00
type = "worker"
host = "mustafar"
storage = "local"
cores = 2
memory = 4096
pod_cidr = {
ipv4 = "10.0.68.0/20"
ipv6 = "fd74:6a6f:0:4000::/52"
}
}
}
}
resource "local_file" "kubeconfig" {
2024-08-04 17:50:50 +00:00
content = templatefile("${path.module}/kubeconfig.tftpl", {
cluster : {
name : module.cluster.name,
endpoint : module.cluster.api.public.endpoint,
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
digitalocean_token = var.digitalocean_token
cluster_name = module.cluster.name
2024-08-02 20:10:21 +00:00
cluster_domain = "k8s.tjo.cloud"
}