Skip to content

Commit 65fd4e1

Browse files
authored
Merge pull request #6 from ZacksHomeLab/wip-new-outputs
feat: additional outputs / refactoring
2 parents 0cb16b9 + 338f81d commit 65fd4e1

File tree

10 files changed

+209
-85
lines changed

10 files changed

+209
-85
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,12 @@ No modules.
559559

560560
| Name | Description |
561561
|------|-------------|
562-
| <a name="output_proxmox_vm_id"></a> [proxmox\_vm\_id](#output\_proxmox\_vm\_id) | The Virtual Machine's Id. |
563-
| <a name="output_proxmox_vm_ip"></a> [proxmox\_vm\_ip](#output\_proxmox\_vm\_ip) | The Virtual Machine's IP on the first Network Adapter. |
564-
| <a name="output_proxmox_vm_name"></a> [proxmox\_vm\_name](#output\_proxmox\_vm\_name) | The Virtual Machine's name. |
565-
| <a name="output_proxmox_vm_node"></a> [proxmox\_vm\_node](#output\_proxmox\_vm\_node) | The Proxmox Node the Virtual Machine was created on. |
566-
| <a name="output_proxmox_vm_template"></a> [proxmox\_vm\_template](#output\_proxmox\_vm\_template) | The name of the template in which the Virtual Machine was created on. |
562+
| <a name="output_disks"></a> [disks](#output\_disks) | The Disk(s) affiliated with said Virtual Machine. |
563+
| <a name="output_ip"></a> [ip](#output\_ip) | The Virtual Machine's IP on the first Network Adapter. |
564+
| <a name="output_name"></a> [name](#output\_name) | The Virtual Machine's name. |
565+
| <a name="output_nics"></a> [nics](#output\_nics) | The Network Adapter(s) affiliated with said Virtual Machine. |
566+
| <a name="output_node"></a> [node](#output\_node) | The Proxmox Node the Virtual Machine was created on. |
567+
| <a name="output_ssh_settings"></a> [ssh\_settings](#output\_ssh\_settings) | The Virtual Machine's SSH Settings. |
568+
| <a name="output_template"></a> [template](#output\_template) | The name of the template in which the Virtual Machine was created on. |
569+
| <a name="output_vmid"></a> [vmid](#output\_vmid) | The Virtual Machine's Id. |
567570
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/complete/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ No resources.
7373

7474
| Name | Description |
7575
|------|-------------|
76-
| <a name="output_vm_id"></a> [vm\_id](#output\_vm\_id) | The Virtual Machine's Id. |
77-
| <a name="output_vm_ip"></a> [vm\_ip](#output\_vm\_ip) | The Virtual Machine's IP on the first Network Adapter. |
78-
| <a name="output_vm_name"></a> [vm\_name](#output\_vm\_name) | The Virtual Machine's name. |
79-
| <a name="output_vm_node"></a> [vm\_node](#output\_vm\_node) | The Proxmox Node the Virtual Machine was created on. |
80-
| <a name="output_vm_template"></a> [vm\_template](#output\_vm\_template) | The name of the template in which the Virtual Machine was created on. |
76+
| <a name="output_disks"></a> [disks](#output\_disks) | The Disk(s) affiliated with said Virtual Machine. |
77+
| <a name="output_ip"></a> [ip](#output\_ip) | The Virtual Machine's IP on the first Network Adapter. |
78+
| <a name="output_name"></a> [name](#output\_name) | The Virtual Machine's name. |
79+
| <a name="output_nics"></a> [nics](#output\_nics) | The Network Adapter(s) affiliated with said Virtual Machine. |
80+
| <a name="output_node"></a> [node](#output\_node) | The Proxmox Node the Virtual Machine was created on. |
81+
| <a name="output_ssh"></a> [ssh](#output\_ssh) | The Virtual Machine's SSH Settings. |
82+
| <a name="output_template"></a> [template](#output\_template) | The name of the template in which the Virtual Machine was created on. |
83+
| <a name="output_vmid"></a> [vmid](#output\_vmid) | The Virtual Machine's Id. |
8184
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/complete/outputs.tf

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
1-
output "vm_id" {
2-
description = "The Virtual Machine's Id."
3-
value = module.cloudinit_vm.proxmox_vm_id
1+
output "disks" {
2+
description = "The Disk(s) affiliated with said Virtual Machine."
3+
value = module.cloudinit_vm.disks
44
}
55

6-
output "vm_ip" {
6+
output "ip" {
77
description = "The Virtual Machine's IP on the first Network Adapter."
8-
value = module.cloudinit_vm.proxmox_vm_ip
8+
value = module.cloudinit_vm.ip
99
}
1010

11-
output "vm_name" {
11+
output "name" {
1212
description = "The Virtual Machine's name."
13-
value = module.cloudinit_vm.proxmox_vm_name
13+
value = module.cloudinit_vm.name
1414
}
1515

16-
output "vm_template" {
17-
description = "The name of the template in which the Virtual Machine was created on."
18-
value = module.cloudinit_vm.proxmox_vm_template
16+
output "nics" {
17+
description = "The Network Adapter(s) affiliated with said Virtual Machine."
18+
value = module.cloudinit_vm.nics
1919
}
2020

21-
output "vm_node" {
21+
output "node" {
2222
description = "The Proxmox Node the Virtual Machine was created on."
23-
value = module.cloudinit_vm.proxmox_vm_node
23+
value = module.cloudinit_vm.node
24+
}
25+
26+
output "ssh" {
27+
description = "The Virtual Machine's SSH Settings."
28+
value = module.cloudinit_vm.ssh_settings
29+
sensitive = true
30+
}
31+
32+
output "template" {
33+
description = "The name of the template in which the Virtual Machine was created on."
34+
value = module.cloudinit_vm.template
35+
}
36+
37+
output "vmid" {
38+
description = "The Virtual Machine's Id."
39+
value = module.cloudinit_vm.vmid
2440
}

examples/multiple-nics/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,12 @@ No resources.
8181

8282
| Name | Description |
8383
|------|-------------|
84-
| <a name="output_proxmox_multi_nic_vm_id"></a> [proxmox\_multi\_nic\_vm\_id](#output\_proxmox\_multi\_nic\_vm\_id) | The Virtual Machine's Id. |
85-
| <a name="output_proxmox_multi_nic_vm_ip"></a> [proxmox\_multi\_nic\_vm\_ip](#output\_proxmox\_multi\_nic\_vm\_ip) | The Virtual Machine's IP on the first Network Adapter. |
86-
| <a name="output_proxmox_multi_nic_vm_name"></a> [proxmox\_multi\_nic\_vm\_name](#output\_proxmox\_multi\_nic\_vm\_name) | The Virtual Machine's name. |
87-
| <a name="output_proxmox_multi_nic_vm_node"></a> [proxmox\_multi\_nic\_vm\_node](#output\_proxmox\_multi\_nic\_vm\_node) | The Proxmox Node the Virtual Machine was created on. |
88-
| <a name="output_proxmox_multi_nic_vm_template"></a> [proxmox\_multi\_nic\_vm\_template](#output\_proxmox\_multi\_nic\_vm\_template) | The name of the template in which the Virtual Machine was created on. |
84+
| <a name="output_disks"></a> [disks](#output\_disks) | The Disk(s) affiliated with said Virtual Machine. |
85+
| <a name="output_ip"></a> [ip](#output\_ip) | The Virtual Machine's IP on the first Network Adapter. |
86+
| <a name="output_name"></a> [name](#output\_name) | The Virtual Machine's name. |
87+
| <a name="output_nics"></a> [nics](#output\_nics) | The Network Adapter(s) affiliated with said Virtual Machine. |
88+
| <a name="output_node"></a> [node](#output\_node) | The Proxmox Node the Virtual Machine was created on. |
89+
| <a name="output_ssh"></a> [ssh](#output\_ssh) | The Virtual Machine's SSH Settings. |
90+
| <a name="output_template"></a> [template](#output\_template) | The name of the template in which the Virtual Machine was created on. |
91+
| <a name="output_vmid"></a> [vmid](#output\_vmid) | The Virtual Machine's Id. |
8992
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/multiple-nics/outputs.tf

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
1-
output "proxmox_multi_nic_vm_id" {
2-
description = "The Virtual Machine's Id."
3-
value = module.multi_nic.proxmox_vm_id
1+
output "disks" {
2+
description = "The Disk(s) affiliated with said Virtual Machine."
3+
value = module.multi_nic.disks
44
}
55

6-
output "proxmox_multi_nic_vm_ip" {
6+
output "ip" {
77
description = "The Virtual Machine's IP on the first Network Adapter."
8-
value = module.multi_nic.proxmox_vm_ip
8+
value = module.multi_nic.ip
99
}
1010

11-
output "proxmox_multi_nic_vm_name" {
11+
output "name" {
1212
description = "The Virtual Machine's name."
13-
value = module.multi_nic.proxmox_vm_name
13+
value = module.multi_nic.name
1414
}
1515

16-
output "proxmox_multi_nic_vm_template" {
17-
description = "The name of the template in which the Virtual Machine was created on."
18-
value = module.multi_nic.proxmox_vm_template
16+
output "nics" {
17+
description = "The Network Adapter(s) affiliated with said Virtual Machine."
18+
value = module.multi_nic.nics
1919
}
2020

21-
output "proxmox_multi_nic_vm_node" {
21+
output "node" {
2222
description = "The Proxmox Node the Virtual Machine was created on."
23-
value = module.multi_nic.proxmox_vm_node
23+
value = module.multi_nic.node
24+
}
25+
26+
output "ssh" {
27+
description = "The Virtual Machine's SSH Settings."
28+
value = module.multi_nic.ssh_settings
29+
sensitive = true
30+
}
31+
32+
output "template" {
33+
description = "The name of the template in which the Virtual Machine was created on."
34+
value = module.multi_nic.template
35+
}
36+
37+
output "vmid" {
38+
description = "The Virtual Machine's Id."
39+
value = module.multi_nic.vmid
2440
}

examples/simple-vm/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ No resources.
7373

7474
| Name | Description |
7575
|------|-------------|
76-
| <a name="output_proxmox_cloudinit_vm_id"></a> [proxmox\_cloudinit\_vm\_id](#output\_proxmox\_cloudinit\_vm\_id) | The Virtual Machine's Id. |
77-
| <a name="output_proxmox_cloudinit_vm_ip"></a> [proxmox\_cloudinit\_vm\_ip](#output\_proxmox\_cloudinit\_vm\_ip) | The Virtual Machine's IP on the first Network Adapter. |
78-
| <a name="output_proxmox_cloudinit_vm_name"></a> [proxmox\_cloudinit\_vm\_name](#output\_proxmox\_cloudinit\_vm\_name) | The Virtual Machine's name. |
79-
| <a name="output_proxmox_cloudinit_vm_node"></a> [proxmox\_cloudinit\_vm\_node](#output\_proxmox\_cloudinit\_vm\_node) | The Proxmox Node the Virtual Machine was created on. |
80-
| <a name="output_proxmox_cloudinit_vm_template"></a> [proxmox\_cloudinit\_vm\_template](#output\_proxmox\_cloudinit\_vm\_template) | The name of the template in which the Virtual Machine was created on. |
76+
| <a name="output_disks"></a> [disks](#output\_disks) | The Disk(s) affiliated with said Virtual Machine. |
77+
| <a name="output_ip"></a> [ip](#output\_ip) | The Virtual Machine's IP on the first Network Adapter. |
78+
| <a name="output_name"></a> [name](#output\_name) | The Virtual Machine's name. |
79+
| <a name="output_nics"></a> [nics](#output\_nics) | The Network Adapter(s) affiliated with said Virtual Machine. |
80+
| <a name="output_node"></a> [node](#output\_node) | The Proxmox Node the Virtual Machine was created on. |
81+
| <a name="output_ssh"></a> [ssh](#output\_ssh) | The Virtual Machine's SSH Settings. |
82+
| <a name="output_template"></a> [template](#output\_template) | The name of the template in which the Virtual Machine was created on. |
83+
| <a name="output_vmid"></a> [vmid](#output\_vmid) | The Virtual Machine's Id. |
8184
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/simple-vm/outputs.tf

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
1-
output "proxmox_cloudinit_vm_id" {
2-
description = "The Virtual Machine's Id."
3-
value = module.cloudinit_vm.proxmox_vm_id
4-
}
5-
6-
output "proxmox_cloudinit_vm_ip" {
7-
description = "The Virtual Machine's IP on the first Network Adapter."
8-
value = module.cloudinit_vm.proxmox_vm_ip
9-
}
10-
11-
output "proxmox_cloudinit_vm_name" {
12-
description = "The Virtual Machine's name."
13-
value = module.cloudinit_vm.proxmox_vm_name
14-
}
15-
16-
output "proxmox_cloudinit_vm_template" {
17-
description = "The name of the template in which the Virtual Machine was created on."
18-
value = module.cloudinit_vm.proxmox_vm_template
19-
}
20-
21-
output "proxmox_cloudinit_vm_node" {
22-
description = "The Proxmox Node the Virtual Machine was created on."
23-
value = module.cloudinit_vm.proxmox_vm_node
24-
}
1+
output "disks" {
2+
description = "The Disk(s) affiliated with said Virtual Machine."
3+
value = module.cloudinit_vm.disks
4+
}
5+
6+
output "ip" {
7+
description = "The Virtual Machine's IP on the first Network Adapter."
8+
value = module.cloudinit_vm.ip
9+
}
10+
11+
output "name" {
12+
description = "The Virtual Machine's name."
13+
value = module.cloudinit_vm.name
14+
}
15+
16+
output "nics" {
17+
description = "The Network Adapter(s) affiliated with said Virtual Machine."
18+
value = module.cloudinit_vm.nics
19+
}
20+
21+
output "node" {
22+
description = "The Proxmox Node the Virtual Machine was created on."
23+
value = module.cloudinit_vm.node
24+
}
25+
26+
output "ssh" {
27+
description = "The Virtual Machine's SSH Settings."
28+
value = module.cloudinit_vm.ssh_settings
29+
sensitive = true
30+
}
31+
32+
output "template" {
33+
description = "The name of the template in which the Virtual Machine was created on."
34+
value = module.cloudinit_vm.template
35+
}
36+
37+
output "vmid" {
38+
description = "The Virtual Machine's Id."
39+
value = module.cloudinit_vm.vmid
40+
}

outputs.tf

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,46 @@
1-
output "proxmox_vm_id" {
2-
description = "The Virtual Machine's Id."
3-
value = try([for vm in proxmox_vm_qemu.cloudinit : tonumber(element(split("/", vm.id), length(split("/", vm.id)) - 1))], "")
1+
output "disks" {
2+
description = "The Disk(s) affiliated with said Virtual Machine."
3+
value = var.create_vm ? { for i, disk in proxmox_vm_qemu.cloudinit[0].disk : i => disk } : null
44
}
55

6-
output "proxmox_vm_ip" {
6+
output "ip" {
77
description = "The Virtual Machine's IP on the first Network Adapter."
8-
value = proxmox_vm_qemu.cloudinit[*].ssh_host
8+
value = var.create_vm ? proxmox_vm_qemu.cloudinit[0].default_ipv4_address : null
99
}
1010

11-
output "proxmox_vm_name" {
11+
output "name" {
1212
description = "The Virtual Machine's name."
13-
value = proxmox_vm_qemu.cloudinit[*].name
13+
value = var.create_vm ? proxmox_vm_qemu.cloudinit[0].name : null
1414
}
1515

16-
output "proxmox_vm_template" {
17-
description = "The name of the template in which the Virtual Machine was created on."
18-
value = proxmox_vm_qemu.cloudinit[*].clone
16+
output "nics" {
17+
description = "The Network Adapter(s) affiliated with said Virtual Machine."
18+
value = var.create_vm ? { for i, network in proxmox_vm_qemu.cloudinit[0].network : i => network } : null
1919
}
2020

21-
output "proxmox_vm_node" {
21+
output "node" {
2222
description = "The Proxmox Node the Virtual Machine was created on."
23-
value = proxmox_vm_qemu.cloudinit[*].target_node
23+
value = var.create_vm ? proxmox_vm_qemu.cloudinit[0].target_node : null
24+
}
25+
26+
output "ssh_settings" {
27+
description = "The Virtual Machine's SSH Settings."
28+
value = var.create_vm ? {
29+
ssh_host = try(proxmox_vm_qemu.cloudinit[0].ssh_host, "")
30+
ssh_port = try(proxmox_vm_qemu.cloudinit[0].ssh_port, "")
31+
ssh_user = try(proxmox_vm_qemu.cloudinit[0].ssh_user, "")
32+
sshkeys = try(proxmox_vm_qemu.cloudinit[0].sshkeys, "")
33+
} : null
34+
35+
sensitive = true
36+
}
37+
38+
output "template" {
39+
description = "The name of the template in which the Virtual Machine was created on."
40+
value = var.create_vm ? proxmox_vm_qemu.cloudinit[0].clone : null
41+
}
42+
43+
output "vmid" {
44+
description = "The Virtual Machine's Id."
45+
value = var.create_vm ? tonumber(element(split("/", proxmox_vm_qemu.cloudinit[0].id), length(split("/", proxmox_vm_qemu.cloudinit[0].id)) - 1)) : null
2446
}

wrappers/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,12 @@ No resources.
9090

9191
| Name | Description |
9292
|------|-------------|
93-
| <a name="output_proxmox_terragrunt_wrapper"></a> [proxmox\_terragrunt\_wrapper](#output\_proxmox\_terragrunt\_wrapper) | Output the contents of the Terragrunt Wrapper. |
93+
| <a name="output_disks"></a> [disks](#output\_disks) | The Disk(s) affiliated with said Virtual Machine. |
94+
| <a name="output_ip"></a> [ip](#output\_ip) | The Virtual Machine's IP on the first Network Adapter. |
95+
| <a name="output_name"></a> [name](#output\_name) | The Virtual Machine's name. |
96+
| <a name="output_nics"></a> [nics](#output\_nics) | The Network Adapter(s) affiliated with said Virtual Machine. |
97+
| <a name="output_node"></a> [node](#output\_node) | The Proxmox Node the Virtual Machine was created on. |
98+
| <a name="output_ssh"></a> [ssh](#output\_ssh) | The Virtual Machine's SSH Settings. |
99+
| <a name="output_template"></a> [template](#output\_template) | The name of the template in which the Virtual Machine was created on. |
100+
| <a name="output_vmid"></a> [vmid](#output\_vmid) | The Virtual Machine's Id. |
94101
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

wrappers/outputs.tf

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
1-
output "proxmox_terragrunt_wrapper" {
2-
description = "Output the contents of the Terragrunt Wrapper."
3-
value = module.terragrunt_wrapper
4-
#sensitive = true
1+
output "disks" {
2+
description = "The Disk(s) affiliated with said Virtual Machine."
3+
value = module.terragrunt_wrapper.disks
4+
}
5+
6+
output "ip" {
7+
description = "The Virtual Machine's IP on the first Network Adapter."
8+
value = module.terragrunt_wrapper.ip
9+
}
10+
11+
output "name" {
12+
description = "The Virtual Machine's name."
13+
value = module.terragrunt_wrapper.name
14+
}
15+
16+
output "nics" {
17+
description = "The Network Adapter(s) affiliated with said Virtual Machine."
18+
value = module.terragrunt_wrapper.nics
19+
}
20+
21+
output "node" {
22+
description = "The Proxmox Node the Virtual Machine was created on."
23+
value = module.terragrunt_wrapper.node
24+
}
25+
26+
output "ssh" {
27+
description = "The Virtual Machine's SSH Settings."
28+
value = module.terragrunt_wrapper.ssh_settings
29+
sensitive = true
30+
}
31+
32+
output "template" {
33+
description = "The name of the template in which the Virtual Machine was created on."
34+
value = module.terragrunt_wrapper.template
35+
}
36+
37+
output "vmid" {
38+
description = "The Virtual Machine's Id."
39+
value = module.terragrunt_wrapper.vmid
540
}

0 commit comments

Comments
 (0)