0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-01 19:12:59 +00:00
terraform-provider-proxmox/examples/guides/cloud-init/native/main.tf
Pavel Boldyrev 8c2a071b40
chore(docs): minor fixes / updates in guides (#2014)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-06-30 22:07:30 -04:00

47 lines
1.0 KiB
HCL

data "local_file" "ssh_public_key" {
filename = "./id_rsa.pub"
}
resource "proxmox_virtual_environment_vm" "ubuntu_vm" {
name = "test-ubuntu"
node_name = "pve"
# should be true if qemu agent is not installed / enabled on the VM
stop_on_destroy = true
initialization {
ip_config {
ipv4 {
address = "192.168.3.233/24"
gateway = "192.168.3.1"
}
}
user_account {
username = "ubuntu"
keys = [trimspace(data.local_file.ssh_public_key.content)]
}
}
disk {
datastore_id = "local-lvm"
file_id = proxmox_virtual_environment_download_file.ubuntu_cloud_image.id
interface = "virtio0"
iothread = true
discard = "on"
size = 20
}
network_device {
bridge = "vmbr0"
}
}
resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image" {
content_type = "iso"
datastore_id = "local"
node_name = "pve"
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
}