Files
NewWatari/lxc/grail-2/main.tf
Ryan Toler f7bbeea04e test
2026-05-13 06:39:16 +00:00

72 lines
1.5 KiB
HCL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = "0.97.1"
}
}
}
# ---------------------------------------------------------------
# Cloud‑Init snippet – must live in the same module as the VM
# ---------------------------------------------------------------
resource "proxmox_virtual_environment_file" "cloud_config" {
content_type = "snippets"
datastore_id = "local"
node_name = "pve-node"
source_raw {
data = file("${path.module}/user-data.yaml")
file_name = "debian-cloud-config.yaml"
}
}
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"
}
}