0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00
terraform-provider-proxmox/examples/guides/clone-vm/clone.tf
Pavel Boldyrev a681e828bf
chore(docs): update cloud-init configuration examples (#1830)
* chore(docs): update cloud-init and VM configuration examples

- Added timezone and package installation for qemu-guest-agent in cloud-init configuration.
- Updated VM configuration to include 'started' attribute and clarified agent usage in documentation.

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* not sure why the image checksum has changed

This looks a bit suspicious, but I can ignore this for the test code. In production that would be a red flag requiring investigation

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-03-19 22:11:07 -04:00

37 lines
1.0 KiB
HCL

resource "proxmox_virtual_environment_vm" "ubuntu_clone" {
name = "ubuntu-clone"
node_name = "pve"
clone {
vm_id = proxmox_virtual_environment_vm.ubuntu_template.id
}
agent {
# NOTE: The agent is installed and enabled as part of the cloud-init configuration in the template VM, see cloud-config.tf
# The working agent is *required* to retrieve the VM IP addresses.
# If you are using a different cloud-init configuration, or a different clone source
# that does not have the qemu-guest-agent installed, you may need to disable the `agent` below and remove the `vm_ipv4_address` output.
# See https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_vm#qemu-guest-agent for more details.
enabled = true
}
memory {
dedicated = 768
}
initialization {
dns {
servers = ["1.1.1.1"]
}
ip_config {
ipv4 {
address = "dhcp"
}
}
}
}
output "vm_ipv4_address" {
value = proxmox_virtual_environment_vm.ubuntu_clone.ipv4_addresses[1][0]
}