This repository was archived by the owner on Nov 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
99 lines (77 loc) · 2.37 KB
/
main.tf
File metadata and controls
99 lines (77 loc) · 2.37 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
resource "tls_private_key" "ssh-key" {
algorithm = "ED25519"
}
resource "hcloud_ssh_key" "tf-ssh-key" {
name = "tf-ssh-key"
public_key = tls_private_key.ssh-key.public_key_openssh
}
module "control-plane" {
source = "./modules/control-plane"
providers = {
hcloud = hcloud
}
cluster_api_token = var.cluster_api_token
firewall_ids = local.firewall_enabled ? [hcloud_firewall.cloudlab.id] : []
placement_group_id = hcloud_placement_group.cloudlab.id
name = "control-plane"
server_type = "cx21"
network_id = hcloud_network.cloudlab.id
pod_ipv4_cidr = local.pod_ipv4_cidr
authorized_keys = [var.management_ssh_key_id, local.ssh_key_id]
ssh_private_key = local.ssh_private_key
}
module "worker" {
source = "./modules/worker"
providers = {
hcloud = hcloud
}
count = 3
name = "worker-${count.index}"
server_type = "cx21"
firewall_ids = local.firewall_enabled ? [hcloud_firewall.cloudlab.id] : []
placement_group_id = hcloud_placement_group.cloudlab.id
network_id = hcloud_network.cloudlab.id
authorized_keys = [var.management_ssh_key_id, local.ssh_key_id]
ssh_private_key = local.ssh_private_key
join_command = module.control-plane.kubeadm_join_command
depends_on = [
module.control-plane
]
}
module "gitops" {
source = "./modules/gitops"
providers = {
github = github
}
argocd_url = "https://argocd.wesley.io"
repo_name = "infrastructure"
repo_description = "My Homelab and Cloudlab"
control_plane_ip = module.control-plane.public_ipv4_address
ssh_private_key = local.ssh_private_key
op_credentials = var.op_credentials
op_token = var.op_token
gha_tf_api_token = var.gha_tf_api_token
depends_on = [
module.control-plane
]
}
module "cloudlab-cluster" {
source = "./modules/cluster"
control_plane = module.control-plane.public_ipv4_address
workers = {
for worker in module.worker : (worker.name) => worker.private_ipv4_address
}
ssh_private_key = local.ssh_private_key
kube_version = "1.26.3"
depends_on = [
module.control-plane,
module.worker[0]
]
}
module "homelab-cluster" {
source = "./modules/cluster"
control_plane = var.homelab_ipv4_address
workers = {}
ssh_private_key = local.ssh_private_key
kube_version = "1.26.3"
}