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 ¶
const ProviderVersion = "0.122.0"
ProviderVersion is the pinned bpg/proxmox release.
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 ¶
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.
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 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.