creates lxc, but doesn't attach console

This commit is contained in:
2025-07-31 13:28:42 +00:00
parent 9ebe161d66
commit 6c78ed06cf
3 changed files with 93 additions and 0 deletions

5
.gitignore vendored Normal file
View File

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

71
main.tf Normal file
View File

@@ -0,0 +1,71 @@
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" "jenkins" {
description = "Managed by Terraform"
start_on_boot = "true"
cpu {
cores = 2
}
memory {
dedicated = 2048
}
disk {
datastore_id = "local-lvm"
size = 15
}
initialization {
dns {
servers = ["192.168.0.181"]
}
hostname = "jenkins"
ip_config {
ipv4 {
address = "dhcp"
}
}
}
network_interface {
name = "eth0"
}
node_name = "homestrg1"
operating_system {
template_file_id = "local:vztmpl/ubuntu-24.10-standard_24.10-1_amd64.tar.zst"
type = "ubuntu"
}
tags = [
"linux",
"ubuntu"
]
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"
}