mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-08 14:55:02 +00:00
* feat(vm): Import Disk via API. Signed-off-by: Marco Attia <54147992+Vaneixus@users.noreply.github.com> * lint(vm): fix Linter Issues. Signed-off-by: Marco Attia <54147992+Vaneixus@users.noreply.github.com> * fix(vm): import_from update issues. Signed-off-by: Marco Attia <54147992+Vaneixus@users.noreply.github.com> * fix: store `import_from` in the state, add acc test for `import_from` Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> * chore: update examples and docs Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> * fix: linter Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> * chore: re-gen docs Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --------- Signed-off-by: Marco Attia <54147992+Vaneixus@users.noreply.github.com> Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
54 lines
1.1 KiB
HCL
54 lines
1.1 KiB
HCL
resource "proxmox_virtual_environment_vm" "ubuntu_vm" {
|
|
name = "test-ubuntu"
|
|
node_name = "pve"
|
|
|
|
agent {
|
|
enabled = true
|
|
}
|
|
|
|
cpu {
|
|
cores = 2
|
|
}
|
|
|
|
memory {
|
|
dedicated = 2048
|
|
}
|
|
|
|
disk {
|
|
datastore_id = "local-lvm"
|
|
import_from = proxmox_virtual_environment_download_file.ubuntu_cloud_image.id
|
|
interface = "virtio0"
|
|
iothread = true
|
|
discard = "on"
|
|
size = 20
|
|
}
|
|
|
|
initialization {
|
|
ip_config {
|
|
ipv4 {
|
|
address = "dhcp"
|
|
}
|
|
}
|
|
|
|
user_data_file_id = proxmox_virtual_environment_file.user_data_cloud_config.id
|
|
}
|
|
|
|
network_device {
|
|
bridge = "vmbr0"
|
|
}
|
|
|
|
}
|
|
|
|
resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image" {
|
|
content_type = "import"
|
|
datastore_id = "local"
|
|
node_name = "pve"
|
|
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
|
|
# need to rename the file to *.qcow2 to indicate the actual file format for import
|
|
file_name = "jammy-server-cloudimg-amd64.qcow2"
|
|
}
|
|
|
|
output "vm_ipv4_address" {
|
|
value = proxmox_virtual_environment_vm.ubuntu_vm.ipv4_addresses[1][0]
|
|
}
|