Instalacja terraforma
# ściągnięcie i modyfikacja pluginu, jeżeli terraform nie ma mieć dostępu do wszystkich pul
git clone https://github.com/Telmate/terraform-provider-proxmox /home/pcss/github.com/Telmate/terraform-provider-proxmox
cd github.com/Telmate/terraform-provider-proxmox/
zmodyfikować plik proxmox/provider.go, by nie sprawdzał uprawnień
make
PLUGIN_ARCH=linux_amd64
mkdir -p ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}
cp bin/terraform-provider-proxmox ~/.terraform.d/plugins/registry.example.com/telmate/proxmox/1.0.0/${PLUGIN_ARCH}/ # powtórzyć, jeśli ściągnie oryginał
Przykładowy plik terraforma
Plik zakłada 3 maszyny wirtualne
resource "proxmox_vm_qemu" proxmox-virt" {
count = 3
name = "proxmox-virt-${count.index + 1}"
desc = "openstack labitaas kolla controller"
vmid = 1521+count.index
target_node = "hx-core-${count.index + 1}"
pool = "POOL01"
clone = "ubuntu-22-template"
agent = 1
os_type = "cloud-init"
define_connection_info = false
qemu_os = "l26"
cores = 8
sockets = 1
memory = "16384"
scsihw = "virtio-scsi-pci"
bootdisk = "scsi0"
disk {
slot = 0
size = "80G"
type = "scsi"
storage = "STORAGE01"
iothread = 0
}
network {
model = "virtio"
bridge = "vmbr1"
}
network {
model = "virtio"
bridge = "vmbr2"
}
network {
model = "virtio"
bridge = "vmbr3"
}
lifecycle {
ignore_changes = [
target_node, disk
]
}
# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=172.16.1.20${count.index + 1}/20"
ipconfig1 = "ip=172.16.2.20${count.index + 1}/20,gw=172.16.2.254"
ipconfig2 = "ip=172.16.3.20${count.index + 1}/20"
nameserver = "1.1.1.1"
ciuser = var.username
sshkeys = var.sshkeys