first attempt at vm deplyoment

This commit is contained in:
Ryan Toler
2026-05-13 06:32:19 +00:00
parent bf79507169
commit d01d11fa59
2 changed files with 100 additions and 0 deletions

48
lxc/grail-2/main.tf Normal file
View File

@@ -0,0 +1,48 @@
resource "proxmox_virtual_environment_vm" "debian_vm" {
name = "debian-bgp-node"
node_name = var.node_name
initialization {
user_data_file_id = proxmox_virtual_environment_file.cloud_config.id
ip_config {
ipv4 {
address = var.ip_address
gateway = var.gateway
}
}
dns {
servers = ["1.1.1.1", "8.8.8.8"]
}
hostname = var.hostname
user_account {
password = var.password
# keys = [trimspace(tls_private_key.example.public_key_openssh)]
}
}
network_device {
bridge = "vmbr0"
}
disk {
datastore_id = var.datastore_id
file_id = "local:iso/debian-13.4.0-amd64-netinst.iso"
interface = "scsi0"
size = var.disk_size_gb
}
tags = ["deb13", "terraform"]
cpu { cores = var.cores }
memory {
dedicated = var.memory
swap = var.swap
}
startup {
order = "3"
up_delay = "60"
down_delay = "60"
}
}

52
lxc/grail-2/vars.tf Normal file
View File

@@ -0,0 +1,52 @@
# ---------------------------------------------------------------
# General container settings (things that rarely change)
# ---------------------------------------------------------------
variable "start_on_boot" {
type = bool
default = true
}
variable "unprivileged" {
type = bool
default = false
}
variable "nesting_enabled" {
type = bool
default = true
}
# ---------------------------------------------------------------
# Disk sizes (primary + optional)
# ---------------------------------------------------------------
variable "datastore_id" {
type = string
default = "local-lvm"
}
variable "disk_size_gb" {
type = number
default = 64
}
# ---------------------------------------------------------------
# Initialization specifics
# ---------------------------------------------------------------
variable "hostname" { default = "grailvm" }
variable "ip_address" { default = "192.168.0.58/24" }
variable "gateway" { default = "192.168.0.1" }
variable "password" { default = "example" }
variable "memory" { default = 4048 } # Sets dedicated RAM to 2048 MB (2 GB)
variable "swap" { default = 1024 } # Sets swap space to 1024 MB (1 GB)
variable "cores" { default = 6 }
# ---------------------------------------------------------------
# Node & template file
# ---------------------------------------------------------------
variable "node_name" { default = "watari" }
variable "template_file_id" { default = "local:vztmpl/debian-13-standard_13.4-sudo_amd64.tar.zst" }
# ---------------------------------------------------------------
# (Optional) Mount point volume name – set if you enable mounts
# ---------------------------------------------------------------
# variable "mount_volume" { default = "" }