0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-04 04:22:59 +00:00

feat(vm): add support up to 32 network interfaces (#822)

* Added NetworkDevices and IPs

Removed previous limitation to 8 network interfaces/ips and moved to
new proxmox limit (up to 32)

Modifiche di cui verrà eseguito il commit:
modificato:             proxmox/nodes/vms/vms_types.go

Signed-off-by: bitchecker <ciro.deluca@autistici.org>

* Code alignment for vm resource

After updates to vm_types structure definition, updated the resource
code in order to reflect changes

Modifiche di cui verrà eseguito il commit:
modificato:             proxmoxtf/resource/vm.go

Signed-off-by: bitchecker <ciro.deluca@autistici.org>

* fix few typos, fix struct to state mapping

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: bitchecker <ciro.deluca@autistici.org>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
bitchecker 2023-12-20 03:33:40 +01:00 committed by GitHub
parent ec31d75fe1
commit 4113bec1b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 100 additions and 3 deletions

View File

@ -467,6 +467,30 @@ type GetResponseData struct {
IPConfig5 *CustomCloudInitIPConfig `json:"ipconfig5,omitempty"` IPConfig5 *CustomCloudInitIPConfig `json:"ipconfig5,omitempty"`
IPConfig6 *CustomCloudInitIPConfig `json:"ipconfig6,omitempty"` IPConfig6 *CustomCloudInitIPConfig `json:"ipconfig6,omitempty"`
IPConfig7 *CustomCloudInitIPConfig `json:"ipconfig7,omitempty"` IPConfig7 *CustomCloudInitIPConfig `json:"ipconfig7,omitempty"`
IPConfig8 *CustomCloudInitIPConfig `json:"ipconfig8,omitempty"`
IPConfig9 *CustomCloudInitIPConfig `json:"ipconfig9,omitempty"`
IPConfig10 *CustomCloudInitIPConfig `json:"ipconfig10,omitempty"`
IPConfig11 *CustomCloudInitIPConfig `json:"ipconfig11,omitempty"`
IPConfig12 *CustomCloudInitIPConfig `json:"ipconfig12,omitempty"`
IPConfig13 *CustomCloudInitIPConfig `json:"ipconfig13,omitempty"`
IPConfig14 *CustomCloudInitIPConfig `json:"ipconfig14,omitempty"`
IPConfig15 *CustomCloudInitIPConfig `json:"ipconfig15,omitempty"`
IPConfig16 *CustomCloudInitIPConfig `json:"ipconfig16,omitempty"`
IPConfig17 *CustomCloudInitIPConfig `json:"ipconfig17,omitempty"`
IPConfig18 *CustomCloudInitIPConfig `json:"ipconfig18,omitempty"`
IPConfig19 *CustomCloudInitIPConfig `json:"ipconfig19,omitempty"`
IPConfig20 *CustomCloudInitIPConfig `json:"ipconfig20,omitempty"`
IPConfig21 *CustomCloudInitIPConfig `json:"ipconfig21,omitempty"`
IPConfig22 *CustomCloudInitIPConfig `json:"ipconfig22,omitempty"`
IPConfig23 *CustomCloudInitIPConfig `json:"ipconfig23,omitempty"`
IPConfig24 *CustomCloudInitIPConfig `json:"ipconfig24,omitempty"`
IPConfig25 *CustomCloudInitIPConfig `json:"ipconfig25,omitempty"`
IPConfig26 *CustomCloudInitIPConfig `json:"ipconfig26,omitempty"`
IPConfig27 *CustomCloudInitIPConfig `json:"ipconfig27,omitempty"`
IPConfig28 *CustomCloudInitIPConfig `json:"ipconfig28,omitempty"`
IPConfig29 *CustomCloudInitIPConfig `json:"ipconfig29,omitempty"`
IPConfig30 *CustomCloudInitIPConfig `json:"ipconfig30,omitempty"`
IPConfig31 *CustomCloudInitIPConfig `json:"ipconfig31,omitempty"`
KeyboardLayout *string `json:"keyboard,omitempty"` KeyboardLayout *string `json:"keyboard,omitempty"`
KVMArguments *string `json:"args,omitempty"` KVMArguments *string `json:"args,omitempty"`
KVMEnabled *types.CustomBool `json:"kvm,omitempty"` KVMEnabled *types.CustomBool `json:"kvm,omitempty"`
@ -484,6 +508,30 @@ type GetResponseData struct {
NetworkDevice5 *CustomNetworkDevice `json:"net5,omitempty"` NetworkDevice5 *CustomNetworkDevice `json:"net5,omitempty"`
NetworkDevice6 *CustomNetworkDevice `json:"net6,omitempty"` NetworkDevice6 *CustomNetworkDevice `json:"net6,omitempty"`
NetworkDevice7 *CustomNetworkDevice `json:"net7,omitempty"` NetworkDevice7 *CustomNetworkDevice `json:"net7,omitempty"`
NetworkDevice8 *CustomNetworkDevice `json:"net8,omitempty"`
NetworkDevice9 *CustomNetworkDevice `json:"net9,omitempty"`
NetworkDevice10 *CustomNetworkDevice `json:"net10,omitempty"`
NetworkDevice11 *CustomNetworkDevice `json:"net11,omitempty"`
NetworkDevice12 *CustomNetworkDevice `json:"net12,omitempty"`
NetworkDevice13 *CustomNetworkDevice `json:"net13,omitempty"`
NetworkDevice14 *CustomNetworkDevice `json:"net14,omitempty"`
NetworkDevice15 *CustomNetworkDevice `json:"net15,omitempty"`
NetworkDevice16 *CustomNetworkDevice `json:"net16,omitempty"`
NetworkDevice17 *CustomNetworkDevice `json:"net17,omitempty"`
NetworkDevice18 *CustomNetworkDevice `json:"net18,omitempty"`
NetworkDevice19 *CustomNetworkDevice `json:"net19,omitempty"`
NetworkDevice20 *CustomNetworkDevice `json:"net20,omitempty"`
NetworkDevice21 *CustomNetworkDevice `json:"net21,omitempty"`
NetworkDevice22 *CustomNetworkDevice `json:"net22,omitempty"`
NetworkDevice23 *CustomNetworkDevice `json:"net23,omitempty"`
NetworkDevice24 *CustomNetworkDevice `json:"net24,omitempty"`
NetworkDevice25 *CustomNetworkDevice `json:"net25,omitempty"`
NetworkDevice26 *CustomNetworkDevice `json:"net26,omitempty"`
NetworkDevice27 *CustomNetworkDevice `json:"net27,omitempty"`
NetworkDevice28 *CustomNetworkDevice `json:"net28,omitempty"`
NetworkDevice29 *CustomNetworkDevice `json:"net29,omitempty"`
NetworkDevice30 *CustomNetworkDevice `json:"net30,omitempty"`
NetworkDevice31 *CustomNetworkDevice `json:"net31,omitempty"`
NUMADevices *CustomNUMADevices `json:"numa_devices,omitempty"` NUMADevices *CustomNUMADevices `json:"numa_devices,omitempty"`
NUMAEnabled *types.CustomBool `json:"numa,omitempty"` NUMAEnabled *types.CustomBool `json:"numa,omitempty"`
OSType *string `json:"ostype,omitempty"` OSType *string `json:"ostype,omitempty"`

View File

@ -142,7 +142,7 @@ const (
dvResourceVirtualEnvironmentVMHookScript = "" dvResourceVirtualEnvironmentVMHookScript = ""
maxResourceVirtualEnvironmentVMAudioDevices = 1 maxResourceVirtualEnvironmentVMAudioDevices = 1
maxResourceVirtualEnvironmentVMNetworkDevices = 8 maxResourceVirtualEnvironmentVMNetworkDevices = 32
maxResourceVirtualEnvironmentVMSerialDevices = 4 maxResourceVirtualEnvironmentVMSerialDevices = 4
maxResourceVirtualEnvironmentVMHostPCIDevices = 8 maxResourceVirtualEnvironmentVMHostPCIDevices = 8
maxResourceVirtualEnvironmentVMHostUSBDevices = 4 maxResourceVirtualEnvironmentVMHostUSBDevices = 4
@ -4475,6 +4475,31 @@ func vmReadCustom(
vmConfig.IPConfig5, vmConfig.IPConfig5,
vmConfig.IPConfig6, vmConfig.IPConfig6,
vmConfig.IPConfig7, vmConfig.IPConfig7,
vmConfig.IPConfig7,
vmConfig.IPConfig8,
vmConfig.IPConfig9,
vmConfig.IPConfig10,
vmConfig.IPConfig11,
vmConfig.IPConfig12,
vmConfig.IPConfig13,
vmConfig.IPConfig14,
vmConfig.IPConfig15,
vmConfig.IPConfig16,
vmConfig.IPConfig17,
vmConfig.IPConfig18,
vmConfig.IPConfig19,
vmConfig.IPConfig20,
vmConfig.IPConfig21,
vmConfig.IPConfig22,
vmConfig.IPConfig23,
vmConfig.IPConfig24,
vmConfig.IPConfig25,
vmConfig.IPConfig26,
vmConfig.IPConfig27,
vmConfig.IPConfig28,
vmConfig.IPConfig29,
vmConfig.IPConfig30,
vmConfig.IPConfig31,
} }
ipConfigList := make([]interface{}, len(ipConfigObjects)) ipConfigList := make([]interface{}, len(ipConfigObjects))
@ -4677,9 +4702,9 @@ func vmReadCustom(
// Compare the network devices to those stored in the state. // Compare the network devices to those stored in the state.
currentNetworkDeviceList := d.Get(mkResourceVirtualEnvironmentVMNetworkDevice).([]interface{}) currentNetworkDeviceList := d.Get(mkResourceVirtualEnvironmentVMNetworkDevice).([]interface{})
macAddresses := make([]interface{}, 8) macAddresses := make([]interface{}, maxResourceVirtualEnvironmentVMNetworkDevices)
networkDeviceLast := -1 networkDeviceLast := -1
networkDeviceList := make([]interface{}, 8) networkDeviceList := make([]interface{}, maxResourceVirtualEnvironmentVMNetworkDevices)
networkDeviceObjects := []*vms.CustomNetworkDevice{ networkDeviceObjects := []*vms.CustomNetworkDevice{
vmConfig.NetworkDevice0, vmConfig.NetworkDevice0,
vmConfig.NetworkDevice1, vmConfig.NetworkDevice1,
@ -4689,6 +4714,30 @@ func vmReadCustom(
vmConfig.NetworkDevice5, vmConfig.NetworkDevice5,
vmConfig.NetworkDevice6, vmConfig.NetworkDevice6,
vmConfig.NetworkDevice7, vmConfig.NetworkDevice7,
vmConfig.NetworkDevice8,
vmConfig.NetworkDevice9,
vmConfig.NetworkDevice10,
vmConfig.NetworkDevice11,
vmConfig.NetworkDevice12,
vmConfig.NetworkDevice13,
vmConfig.NetworkDevice14,
vmConfig.NetworkDevice15,
vmConfig.NetworkDevice16,
vmConfig.NetworkDevice17,
vmConfig.NetworkDevice18,
vmConfig.NetworkDevice19,
vmConfig.NetworkDevice20,
vmConfig.NetworkDevice21,
vmConfig.NetworkDevice22,
vmConfig.NetworkDevice23,
vmConfig.NetworkDevice24,
vmConfig.NetworkDevice25,
vmConfig.NetworkDevice26,
vmConfig.NetworkDevice27,
vmConfig.NetworkDevice28,
vmConfig.NetworkDevice29,
vmConfig.NetworkDevice30,
vmConfig.NetworkDevice31,
} }
for ni, nd := range networkDeviceObjects { for ni, nd := range networkDeviceObjects {