initial commit

This commit is contained in:
2025-09-18 16:08:49 +00:00
commit fa4a461778
3 changed files with 104 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
*.io
*.hcl
*.backup
*.tfstate
.terraform

82
main.tf Normal file
View File

@@ -0,0 +1,82 @@
terraform {
required_providers {
proxmox = {
source = "bpg/proxmox"
version = ">= 0.50.0"
}
}
}
provider "proxmox" {
endpoint = "https://192.168.0.166:8006"
api_token = var.proxmox_api_token
insecure = true
}
resource "proxmox_virtual_environment_container" "example_template" {
description = "Managed by Terraform"
start_on_boot = "true"
cpu {
cores = 4
}
memory {
dedicated = 8192
swap = 1024
}
disk {
datastore_id = "local-lvm"
size = 75
}
console {
enabled = true
type = "shell"
}
initialization {
dns {
servers = ["192.168.0.181"]
domain = "local"
}
hostname = "minecraft"
ip_config {
ipv4 {
address = "dhcp"
}
}
}
network_interface {
name = "eth0"
firewall = true
}
node_name = "homestrg1"
operating_system {
template_file_id = "local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst"
type = "ubuntu"
}
// use auto-generated vm_id
tags = [
"container",
"ubuntu",
"terraform",
]
startup {
order = "3"
}
}

17
variables.tf Normal file
View File

@@ -0,0 +1,17 @@
variable "proxmox_api_token" {
description = "API token for Proxmox"
type = string
sensitive = true
}
variable "virtual_environment_storage" {
description = "Name of the Proxmox storage"
type = string
default = "local-lvm"
}
variable "release_20250610_ubuntu_24_noble_lxc_img_url" {
type = string
description = "The URL for the Ubuntu 24.04 LXC image"
default = "https://mirrors.servercentral.com/ubuntu-cloud-images/releases/24.04/release-20250610/ubuntu-24.04-server-cloudimg-amd64-root.tar.xz"
}