Skip to content
Snippets Groups Projects
Commit 560cc36c authored by James Arcus's avatar James Arcus
Browse files

Initial commit

parents
No related merge requests found
export PM_API_TOKEN_ID="<Proxmox_API_Token_ID>"
export PM_API_TOKEN_SECRET="<Proxmox_API_Token_Secret>"
.env
*.tfstate
*.backup
*.plan
*.log
.terraform.*
.terraform/**
main.tf 0 → 100644
terraform {
required_providers {
proxmox = {
source = "telmate/proxmox"
version = "3.0.1-rc3"
}
}
}
provider "proxmox" {
pm_api_url = "https://medico.ucc.asn.au:8006/api2/json"
pm_log_enable = true
}
locals {
config = yamldecode(file("membervm_nogui.yaml"))
}
resource "proxmox_vm_qemu" "membervm_nogui" {
for_each = local.config
# Per-VM settings
name = each.key
desc = each.value.desc
vm_state = "stopped"
target_node = each.value.node
sockets = each.value.sockets
cores = each.value.cores
memory = each.value.memory
ciuser = each.value.primary_user
sshkeys = each.value.primary_sshkey
# Set the template, then all remaining settings must match those for that template
clone = "memberVM-nogui-template"
agent = 1
cpu = "x86-64-v2-AES"
scsihw = "virtio-scsi-pci"
boot = "order=scsi0"
ipconfig0 = "ip=dhcp,ip6=auto"
disks {
scsi {
scsi0 {
disk {
storage = "vmstore-ssd"
size = each.value.disk # This can be increased, but must be >= the size of the template image
}
}
}
ide {
ide2 {
cloudinit {
storage = "vmstore-ssd"
}
}
}
}
network {
bridge = "vmbr0"
model = "virtio"
tag = 4
}
# Always the same, regardless of the template chosen
os_type = "cloud-init"
pool = "Member-VMs-Auto"
agent_timeout = 120 # VM creation takes longer than the default of 60s
}
"test-otf-1":
desc: "Test VM 1"
node: medico
sockets: 1
cores: 2
memory: 4096 # in MB
disk: 50G # must be >= 50G
primary_user: debian
primary_sshkey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICSY5zCVa6hsWgGM08u4WVl1bPRjmxLzDyk51ioAd0nT jimbo@potoroo"
"test-otf-2":
desc: "Test VM 2"
node: magikarp
sockets: 1
cores: 1
memory: 1024
disk: 70G # must be >= 50G
primary_user: auser
primary_sshkey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICSY5zCVa6hsWgGM08u4WVl1bPRjmxLzDyk51ioAd0nT jimbo@potoroo"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment