This commit is contained in:
43
tofu/e2e/main.tf
Normal file
43
tofu/e2e/main.tf
Normal file
@@ -0,0 +1,43 @@
|
||||
locals {
|
||||
vm_offset = tonumber(var.run_id) % 44 # 211 - 254
|
||||
clone_vmid = 9100 + local.vm_offset
|
||||
clone_ip = "192.168.178.${211 + local.vm_offset}/24"
|
||||
}
|
||||
|
||||
resource "proxmox_virtual_environment_vm" "e2e_clone" {
|
||||
name = "e2e-run-${var.run_id}"
|
||||
description = "Ephemeral E2E test VM for run ${var.run_id}"
|
||||
tags = ["opentofu", "e2e", "ephemeral", "clone"]
|
||||
|
||||
node_name = var.node_name
|
||||
vm_id = local.clone_vmid
|
||||
|
||||
clone {
|
||||
vm_id = var.clone_template_id
|
||||
full = false
|
||||
}
|
||||
|
||||
agent {
|
||||
enabled = false
|
||||
}
|
||||
stop_on_destroy = true
|
||||
|
||||
initialization {
|
||||
ip_config {
|
||||
ipv4 {
|
||||
address = local.clone_ip
|
||||
gateway = var.gateway
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output "clone_vmid" {
|
||||
description = "VMID of the cloned E2E VM"
|
||||
value = local.clone_vmid
|
||||
}
|
||||
|
||||
output "clone_ip" {
|
||||
description = "IP address of the cloned E2E VM (without CIDR)"
|
||||
value = "192.168.178.${211 + local.vm_offset}" # 211-254
|
||||
}
|
||||
Reference in New Issue
Block a user