Add support for host-managed parameter in LXC networks - #1467
Open
hradaideh wants to merge 2 commits into
Open
Conversation
added 2 commits
December 6, 2025 17:59
- Add host_managed as optional computed field in network schema - Allows provider to handle Proxmox 9.1+ OCI containers - Fixes: proxmox API returned new parameter 'host-managed' error Proxmox 9.1 automatically sets host-managed=1 for OCI-based LXC containers. This change allows the provider to recognize and handle this parameter without throwing an error. Related SDK change: https://github.com/Telmate/proxmox-api-go/commit/[SDK_COMMIT]
- Update AssertNoNonSchemaValues() to handle hyphenated API keys - Normalize keys in adaptDeviceToConf() (hyphen to underscore) - Normalize keys and convert int to bool in FlattenDevicesList() - Add local SDK reference for testing This enables support for Proxmox 9.1 parameters like host-managed while maintaining backward compatibility with existing configurations.
hradaideh
force-pushed
the
fix/lxc-host-managed-support
branch
from
December 6, 2025 15:15
ad16d4d to
9d174b3
Compare
|
I ran into the same problem when trying to create OCI containers and successfully used this MR to overcome it. Would really like to see it merged. |
tomsnunes
approved these changes
Mar 19, 2026
tomsnunes
left a comment
There was a problem hiding this comment.
It seems to fix the problem which it tries to fix.
AjdinDev
approved these changes
Apr 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for Proxmox VE 9.1's
host-managedparameter in LXC network configurations, enabling creation and management of OCI-based containers.Problem
Proxmox VE 9.1 introduced support for OCI (Open Container Initiative) images, allowing users to run Docker Hub images as LXC containers. When creating these containers, Proxmox automatically sets a
host-managed=1parameter on network interfaces. The provider rejected this parameter with an error:This prevented users from using OCI images with Terraform.
Changes
Schema Update
host_managedfield to LXC network schema as an optional, computed booleanValidation Enhancement
AssertNoNonSchemaValues()to handle API keys with hyphens that map to schema keys with underscoresKey Normalization
adaptDeviceToConf()to normalize all keys by replacing hyphens with underscoresFlattenDevicesList()to normalize keys and convert integer boolean values to actual booleansTechnical Details
Proxmox uses hyphenated keys in the API (
host-managed), while Terraform schemas conventionally use underscores (host_managed). Additionally, Proxmox returns boolean values as integers (1/0), requiring type conversion for Terraform's boolean fields.The changes implement a translation layer that:
Example
OCI Container (nginx)
After applying, the state will show:
Traditional Container (Debian)
Traditional containers continue to work as before, with
host_managed = false.Testing
Tested on Proxmox VE 9.1.1 with:
host_managedstatusBackward Compatibility
Fully backward compatible:
host_managedfield is optional and computedDependencies
Requires the corresponding SDK PR: Telmate/proxmox-api-go#530
References
man pctdocuments thehost-managedparameterGET /nodes/{node}/lxc/{vmid}/config