|
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 |
4 | 4 | } |
5 | 5 |
|
6 | | -output "proxmox_vm_ip" { |
| 6 | +output "ip" { |
7 | 7 | 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 |
9 | 9 | } |
10 | 10 |
|
11 | | -output "proxmox_vm_name" { |
| 11 | +output "name" { |
12 | 12 | 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 |
14 | 14 | } |
15 | 15 |
|
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 |
19 | 19 | } |
20 | 20 |
|
21 | | -output "proxmox_vm_node" { |
| 21 | +output "node" { |
22 | 22 | 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 |
24 | 46 | } |
0 commit comments