From d01d60f68c241ffba7f67ee6df57006ae056959a Mon Sep 17 00:00:00 2001 From: Andreas Gruhler Date: Sun, 29 Sep 2019 19:49:47 +0200 Subject: [PATCH 1/4] change gw to string --- proxmox/resource_lxc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proxmox/resource_lxc.go b/proxmox/resource_lxc.go index 2be6037..db48d3c 100644 --- a/proxmox/resource_lxc.go +++ b/proxmox/resource_lxc.go @@ -177,11 +177,11 @@ func resourceLxc() *schema.Resource { Optional: true, }, "gw": { - Type: schema.TypeBool, + Type: schema.TypeString, Optional: true, }, "gw6": { - Type: schema.TypeBool, + Type: schema.TypeString, Optional: true, }, "hwaddr": { From 18743c0e54c108f643e2f45520982c85d4ddecf0 Mon Sep 17 00:00:00 2001 From: Claude Dioudonnat Date: Mon, 30 Sep 2019 13:23:40 +0200 Subject: [PATCH 2/4] Add choice between full or partial clone --- proxmox/resource_vm_qemu.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index ed3110b..feec531 100644 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -71,6 +71,12 @@ func resourceVmQemu() *schema.Resource { Optional: true, ForceNew: true, }, + "full_clone": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Default: true, + }, "qemu_os": { Type: schema.TypeString, Optional: true, @@ -478,6 +484,12 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error { // check if ISO or clone if d.Get("clone").(string) != "" { + fullClone := 1 + if !d.Get("full_clone").(bool) { + fullClone = 0 + } + config.FullClone = &fullClone + sourceVmr, err := client.GetVmRefByName(d.Get("clone").(string)) if err != nil { pmParallelEnd(pconf) From a832f0b98fa978557f61cfda8c4f99cb061706e0 Mon Sep 17 00:00:00 2001 From: Andreas Gruhler Date: Thu, 3 Oct 2019 06:18:10 +0200 Subject: [PATCH 3/4] check feature list length --- proxmox/resource_lxc.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxmox/resource_lxc.go b/proxmox/resource_lxc.go index db48d3c..f2ec98b 100644 --- a/proxmox/resource_lxc.go +++ b/proxmox/resource_lxc.go @@ -519,8 +519,10 @@ func resourceLxcRead(d *schema.ResourceData, meta interface{}) error { d.Set("description", config.Description) defaultFeatures := d.Get("features").(*schema.Set) - featuresWithDefaults := UpdateDeviceConfDefaults(config.Features, defaultFeatures) - d.Set("features", featuresWithDefaults) + if len(defaultFeatures.List()) > 0 { + featuresWithDefaults := UpdateDeviceConfDefaults(config.Features, defaultFeatures) + d.Set("features", featuresWithDefaults) + } d.Set("force", config.Force) d.Set("hookscript", config.Hookscript) From 3c274cd8797c161c48dc47ce701e79a94b6b1c37 Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 3 Oct 2019 11:23:04 -0400 Subject: [PATCH 4/4] Added ipconfig2 everywhere ipconfig1 is listed, should enable 3 networks to be configured in cloud-init As referenced here, https://pve.proxmox.com/wiki/Cloud-Init_Support, proxmox cloud-init should support ipconfig[n]: [gw=] [,gw6=] [,ip=] [,ip6=] Future work should be a loop to support [n] ipconfig lines Changes to be committed: modified: proxmox/resource_vm_qemu.go --- proxmox/resource_vm_qemu.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index feec531..8825c5f 100644 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -387,6 +387,10 @@ func resourceVmQemu() *schema.Resource { Type: schema.TypeString, Optional: true, }, + "ipconfig2": { + Type: schema.TypeString, + Optional: true, + }, "preprovision": { Type: schema.TypeBool, Optional: true, @@ -441,6 +445,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error { Sshkeys: d.Get("sshkeys").(string), Ipconfig0: d.Get("ipconfig0").(string), Ipconfig1: d.Get("ipconfig1").(string), + Ipconfig2: d.Get("ipconfig2").(string), // Deprecated single disk config. Storage: d.Get("storage").(string), DiskSize: d.Get("disk_gb").(float64), @@ -612,6 +617,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error { Sshkeys: d.Get("sshkeys").(string), Ipconfig0: d.Get("ipconfig0").(string), Ipconfig1: d.Get("ipconfig1").(string), + Ipconfig2: d.Get("ipconfig2").(string), // Deprecated single disk config. Storage: d.Get("storage").(string), DiskSize: d.Get("disk_gb").(float64), @@ -704,6 +710,7 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error { d.Set("sshkeys", config.Sshkeys) d.Set("ipconfig0", config.Ipconfig0) d.Set("ipconfig1", config.Ipconfig1) + d.Set("ipconfig2", config.Ipconfig2) // Disks. configDisksSet := d.Get("disk").(*schema.Set) activeDisksSet := UpdateDevicesSet(configDisksSet, config.QemuDisks)