Skip to content

Commit

Permalink
feat: add output to ip addresses by vms
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Dupain committed Nov 3, 2024
1 parent 185de0a commit 89ab61f
Show file tree
Hide file tree
Showing 14 changed files with 100 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ flux-system flux-system main@sha1:5902d505 False True Applied revision: mai
| Name | Description |
|------|-------------|
| <a name="output_cluster_name"></a> [cluster\_name](#output\_cluster\_name) | Retrieves the name for a k8s Talos cluster |
| <a name="output_config_ipv4_addresses"></a> [config\_ipv4\_addresses](#output\_config\_ipv4\_addresses) | Retrieves VM names with IPv4 address for a k8s Talos cluster |
| <a name="output_kube_config"></a> [kube\_config](#output\_kube\_config) | Retrieves the kubeconfig for a k8s Talos cluster |
| <a name="output_talos_config"></a> [talos\_config](#output\_talos\_config) | Retrieves the talosconfig for a k8s Talos cluster |
| <a name="output_vm_ipv4_address_vms"></a> [vm\_ipv4\_address\_vms](#output\_vm\_ipv4\_address\_vms) | Retrieves IPv4 address for a k8s Talos cluster |
Expand Down
2 changes: 1 addition & 1 deletion examples/0-demo-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "talos-k8s-cluster" {
source = "vdupain/talos-k8s-cluster/proxmox"
version = "1.0.0-rc4"
version = "1.0.0-rc5"

cluster = {
name = "demo-cluster"
Expand Down
8 changes: 8 additions & 0 deletions examples/0-demo-cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "cluster_name" {
value = module.talos-k8s-cluster.cluster_name
sensitive = false
}

output "config_ipv4_addresses" {
value = module.talos-k8s-cluster.config_ipv4_addresses
}
2 changes: 1 addition & 1 deletion examples/1-gpu-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "talos-k8s-cluster" {
source = "vdupain/talos-k8s-cluster/proxmox"
version = "1.0.0-rc4"
version = "1.0.0-rc5"

cluster = {
name = "gpu-cluster"
Expand Down
8 changes: 8 additions & 0 deletions examples/1-gpu-cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "cluster_name" {
value = module.talos-k8s-cluster.cluster_name
sensitive = false
}

output "config_ipv4_addresses" {
value = module.talos-k8s-cluster.config_ipv4_addresses
}
2 changes: 1 addition & 1 deletion examples/2-bare-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "talos-k8s-cluster" {
source = "vdupain/talos-k8s-cluster/proxmox"
version = "1.0.0-rc4"
version = "1.0.0-rc5"

cluster = {
name = "bare-cluster"
Expand Down
8 changes: 8 additions & 0 deletions examples/2-bare-cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "cluster_name" {
value = module.talos-k8s-cluster.cluster_name
sensitive = false
}

output "config_ipv4_addresses" {
value = module.talos-k8s-cluster.config_ipv4_addresses
}
28 changes: 28 additions & 0 deletions examples/3-mini-cluster/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module "talos-k8s-cluster" {
source = "vdupain/talos-k8s-cluster/proxmox"
version = "1.0.0-rc5"

cluster = {
name = "mini-cluster"
gateway = "192.168.10.1"
cidr = 24
endpoint = "192.168.10.50"
}

vms = {
"k8s-cp-0" = {
host_node = "pve1"
machine_type = "controlplane"
ip = "192.168.10.50"
cpu = 4
ram_dedicated = 4096
os_disk_size = 10
data_disk_size = 10
datastore_id = "local-lvm"
install_disk = "/dev/sda"
hostname = "cp-0"
}
}

proxmox = var.proxmox
}
8 changes: 8 additions & 0 deletions examples/3-mini-cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
output "cluster_name" {
value = module.talos-k8s-cluster.cluster_name
sensitive = false
}

output "config_ipv4_addresses" {
value = module.talos-k8s-cluster.config_ipv4_addresses
}
13 changes: 13 additions & 0 deletions examples/3-mini-cluster/provider.auto.tfvars.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
proxmox = {
endpoint = "https://pve.domain"
insecure = true
username = "user"
password = "password"
api_token = "user@pve!terraform=secret"
}

github = {
token = "github_pat"
org = "username"
repository = "repository"
}
10 changes: 10 additions & 0 deletions examples/3-mini-cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "proxmox" {
type = object({
endpoint = string
insecure = bool
username = string
password = string
api_token = string
})
sensitive = true
}
1 change: 1 addition & 0 deletions modules/vms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ No modules.

| Name | Description |
|------|-------------|
| <a name="output_config_ipv4_addresses"></a> [config\_ipv4\_addresses](#output\_config\_ipv4\_addresses) | n/a |
| <a name="output_vm_ipv4_address_vms"></a> [vm\_ipv4\_address\_vms](#output\_vm\_ipv4\_address\_vms) | n/a |
<!-- END_TF_DOCS -->
6 changes: 6 additions & 0 deletions modules/vms/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ output "vm_ipv4_address_vms" {
for vm in proxmox_virtual_environment_vm.vms : vm.initialization[0].ip_config[0].ipv4[0].address
]
}

output "config_ipv4_addresses" {
value = {
for vm in proxmox_virtual_environment_vm.vms : vm.name => vm.initialization[0].ip_config[0].ipv4[0].address
}
}
9 changes: 6 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
output "vm_ipv4_address_vms" {
description = "Retrieves IPv4 address for a k8s Talos cluster"
value = [
for vm in module.vms.vm_ipv4_address_vms : vm
]
value = module.vms.vm_ipv4_address_vms
}

output "config_ipv4_addresses" {
description = "Retrieves VM names with IPv4 address for a k8s Talos cluster"
value = module.vms.config_ipv4_addresses
}

output "kube_config" {
Expand Down

0 comments on commit 89ab61f

Please sign in to comment.