Skip to content

Commit bc18cff

Browse files
Merge pull request #62 from pascalinthecloud/58-add-tags-and-description-to-proxmox-vms
feat: added fancy description template for pve vms
2 parents b516a77 + 051272a commit bc18cff

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

outputs.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
output "talosconfig" {
22
description = "Talos configuration file for the cluster"
3-
value = data.talos_client_configuration.this.talos_config
4-
sensitive = true
3+
value = data.talos_client_configuration.this.talos_config
4+
sensitive = true
55
}
66

77
output "kubeconfig" {
@@ -18,5 +18,5 @@ output "kubeconfig" {
1818

1919
output "talos_cluster_health" {
2020
description = "Health status of the Talos cluster, can be used for other ressources to depend on"
21-
value = data.talos_cluster_health.this
21+
value = data.talos_cluster_health.this
2222
}

proxmox_vm_controlplanes.tf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
resource "proxmox_virtual_environment_vm" "controlplane" {
22
for_each = local.controlplanes
33

4-
node_name = each.value.node
5-
name = each.key
6-
description = "controlplane"
4+
node_name = each.value.node
5+
name = each.key
6+
description = templatefile("${path.module}/templates/description.tmpl", {
7+
cluster_name = var.cluster.name,
8+
node_name = each.key
9+
subnet = "${each.value.ip_address}/${each.value.subnet}"
10+
gateway = var.network.gateway
11+
cpu = each.value.cpu
12+
memory = each.value.memory
13+
disk = each.value.disk
14+
proxmox_node = each.value.node
15+
})
716
vm_id = each.value.vm_id
817
machine = "q35"
918
scsi_hardware = "virtio-scsi-single"

proxmox_vm_worker.tf

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
resource "proxmox_virtual_environment_vm" "worker" {
22
for_each = local.workers
33

4-
node_name = each.value.node
5-
name = each.key
6-
description = "worker"
4+
node_name = each.value.node
5+
name = each.key
6+
description = templatefile("${path.module}/templates/description.tmpl", {
7+
cluster_name = var.cluster.name,
8+
node_name = each.key
9+
subnet = "${each.value.ip_address}/${each.value.subnet}"
10+
gateway = var.network.gateway
11+
cpu = each.value.cpu
12+
memory = each.value.memory
13+
disk = each.value.disk
14+
proxmox_node = each.value.node
15+
})
716
vm_id = each.value.vm_id
817
machine = "q35"
918
scsi_hardware = "virtio-scsi-single"

templates/description.tftpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Kubernetes Node Information
2+
🛡️ **Cluster Name**: `${cluster_name}`
3+
🖥️ **Node Name**: `${node_name}`
4+
🌐 **Subnet**: `${subnet}`
5+
🚪 **Gateway**: `${gateway}`
6+
7+
💾 **Resources**:
8+
- **CPU**: `${cpu}` cores
9+
- **Memory**: `${memory}` MB
10+
- **Disk**: `${disk}` GB
11+
12+
⚙️ **Node Placement**:
13+
- **Proxmox Node**: `${proxmox_node}`

0 commit comments

Comments
 (0)