proxmox

package
v0.3.0-dev.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package proxmox declares Proxmox VE LXC containers with the bpg/proxmox OpenTofu provider.

Containers are adopted (imported) as they are, or created from a template. Every setting the construct owns is written explicitly, so a plan shows only real drift. Settings Proxmox fixes at creation (template, privilege, root disk storage) and hand-written descriptions are never reconciled, raw lxc.* lines (GPU passthrough) are never touched, and OpenTofu refuses to destroy any container.

Index

Constants

View Source
const ProviderVersion = "0.122.0"

ProviderVersion is the pinned bpg/proxmox release.

View Source
const ResourceType = "proxmox_virtual_environment_container"

ResourceType is the container resource type the guard inspects.

Variables

This section is empty.

Functions

func Ignored

func Ignored() []string

Ignored lists the attributes never reconciled after creation.

func LeftToProvider

func LeftToProvider() []string

LeftToProvider lists settable attributes (dotted for nested ones) the construct does not write, for the schema test.

func Provider

func Provider(endpoint string) core.Provider

Provider returns the pinned provider for a Proxmox VE API endpoint, e.g. "https://192.168.1.209:8006/". The API token comes only from the environment (PROXMOX_VE_API_TOKEN). TLS is always verified: the node's CA must be trusted where OpenTofu runs (system store or SSL_CERT_FILE).

Types

type Container

type Container struct {
	Props    ContainerProps
	Resource *core.Resource
}

Container is a declared LXC container.

func NewContainer

func NewContainer(stack *core.Stack, id string, p ContainerProps) *Container

NewContainer adds a container to a stack. OpenTofu refuses to destroy it.

func (*Container) Fleet

func (c *Container) Fleet() fleet.Container

Fleet returns the identity the fleet check verifies before any deploy touches this container, so one declaration feeds both.

func (*Container) IPv4

func (c *Container) IPv4() string

IPv4 returns the container's IPv4 address: the static address, or the DHCP reservation.

type ContainerProps

type ContainerProps struct {
	Node     string
	CTID     int
	Hostname string
	// Template is the OS template used on creation, e.g.
	// "local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst". Never reconciled.
	Template string
	// OSType as Proxmox reports it ("debian", "ubuntu").
	OSType string
	// Privileged must be chosen explicitly; containers are unprivileged by
	// default. Creation-only.
	Privileged bool
	Cores      int
	MemoryMiB  int
	SwapMiB    int
	// RootStorage is creation-only; RootSizeGiB may only grow.
	RootStorage string
	RootSizeGiB int
	Features    Features
	Network     Network
	// Nameserver (space-separated) and SearchDomain override the host's DNS.
	Nameserver, SearchDomain string
	Mounts                   []MountPoint
	Devices                  []Device
	StartOnBoot              bool
	// Running is the desired power state.
	Running bool
	Tags    []string
	// Import adopts the existing container Node/CTID instead of creating it.
	Import bool
}

ContainerProps declares a container. Every field is written unless noted.

type Device

type Device struct {
	Path string
	GID  int
}

Device is a device passthrough (devN), e.g. /dev/dri/renderD128.

type Disruption

type Disruption struct {
	Address string `json:"address"`
	CTID    int    `json:"ctid"`
	// Kind is "replace", "delete", "stop", "start" or "reboot".
	Kind string `json:"kind"`
	// Because lists the attributes that trigger it.
	Because []string `json:"because,omitempty"`
}

Disruption is one planned change that would interrupt an existing container.

func Disruptions

func Disruptions(plan io.Reader) ([]Disruption, error)

Disruptions reads `tofu show -json <planfile>` and lists every change that would replace, delete, stop or reboot a container that already exists. Creates (including imports of nothing new) are never disruptions.

func Unapproved

func Unapproved(ds []Disruption, approved []int) []Disruption

Unapproved filters disruptions to those whose CTID is not in approved.

type Features

type Features struct {
	Nesting, KeyCtl, FUSE, Mknod bool
}

Features are LXC feature flags. Changing any flag except Nesting needs root@pam on Proxmox, so plans that would change them fail with a token.

type MountPoint

type MountPoint struct {
	Volume, Path string
	ReadOnly     bool
	// Backup includes a storage volume in vzdump backups (bind mounts never are).
	Backup bool
}

MountPoint is a host bind mount ("/vol1/media") or a storage volume.

type Network

type Network struct {
	// Bridge, e.g. "vmbr0".
	Bridge string
	// MAC is the fixed hardware address; DHCP reservations rely on it. Write
	// it exactly as Proxmox reports it (`pct config`): the provider compares
	// case-sensitively, and a network change reboots a running container.
	MAC string
	// IPv4 is "dhcp" or a CIDR such as "192.168.1.17/24". A CIDR needs Gateway
	// unless NoGateway is set (a LAN-only interface, as Proxmox allows).
	IPv4, Gateway string
	NoGateway     bool
	// IPv6 is "", "auto" or "dhcp".
	IPv6     string
	Firewall bool
	// ReservedIP is the DHCP reservation for a "dhcp" interface (managed in
	// john/ops networking/). Not written to Proxmox; it is the address the
	// fleet identity check expects. Required with dhcp, refused otherwise.
	ReservedIP string
}

Network is the container's single interface, eth0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL