0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-09 15:25:01 +00:00
terraform-provider-proxmox/examples/guides/cloud-image/centos-qcow2/main.tf
Marco Attia ddc4118b08
feat(vm): Import Disk via API. (#2012)
* 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>
2025-07-06 12:00:38 -04:00

32 lines
881 B
HCL

resource "proxmox_virtual_environment_vm" "centos_vm" {
name = "test-centos"
node_name = "pve"
# should be true if qemu agent is not installed / enabled on the VM
stop_on_destroy = true
initialization {
user_account {
# do not use this in production, configure your own ssh key instead!
username = "user"
password = "password"
}
}
disk {
datastore_id = "local-lvm"
import_from = proxmox_virtual_environment_download_file.centos_cloud_image.id
interface = "virtio0"
iothread = true
discard = "on"
size = 20
}
}
resource "proxmox_virtual_environment_download_file" "centos_cloud_image" {
content_type = "import"
datastore_id = "local"
node_name = "pve"
url = "https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-latest.x86_64.qcow2"
}