59 lines
1.0 KiB
HCL
59 lines
1.0 KiB
HCL
terraform {
|
|
required_providers {
|
|
proxmox = {
|
|
source = "bpg/proxmox"
|
|
version = "0.86.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
data "local_file" "proxmox_ssh_private_key" {
|
|
filename = var.proxmox_ssh_privkey_path
|
|
}
|
|
|
|
provider "proxmox" {
|
|
endpoint = var.proxmox_endpoint
|
|
username = var.proxmox_user
|
|
password = var.proxmox_password
|
|
insecure = true
|
|
|
|
ssh {
|
|
agent = true
|
|
username = var.proxmox_ssh_username
|
|
private_key = trimspace(data.local_file.proxmox_ssh_private_key.content)
|
|
}
|
|
}
|
|
|
|
resource "proxmox_virtual_environment_vm" "homeassistant" {
|
|
name = "homeassistant"
|
|
node_name = var.proxmox_node
|
|
|
|
agent { enabled = true }
|
|
|
|
bios = "ovmf"
|
|
|
|
cpu {
|
|
cores = 2
|
|
type = "host"
|
|
}
|
|
|
|
memory {
|
|
dedicated = 8096
|
|
}
|
|
|
|
efi_disk {
|
|
datastore_id = var.vm_datastore
|
|
}
|
|
|
|
disk {
|
|
datastore_id = var.vm_datastore
|
|
import_from = "${var.proxmox_datastore}:import/haos_ova-16.3.qcow2"
|
|
interface = "virtio0"
|
|
size = 100
|
|
}
|
|
|
|
network_device {
|
|
bridge = var.bridge
|
|
}
|
|
}
|