Merge pull request #107 from V-Paranoiaque/feature/hastate

New feature, HA management
This commit is contained in:
Grant Gongaware 2019-11-04 09:54:36 -08:00 committed by GitHub
commit fc3b001ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions

View File

@ -134,6 +134,8 @@ resource "proxmox_vm_qemu" "prepprovision-test" {
hotplug = "network,disk,usb"
# Default boot disk
bootdisk = "virtio0"
# HA, you need to use a shared disk for this feature (ex: rbd)
hastate = ""
network {
id = 0
model = "virtio"

2
go.mod
View File

@ -3,6 +3,6 @@ module github.com/Telmate/terraform-provider-proxmox
go 1.13
require (
github.com/Telmate/proxmox-api-go v0.0.0-20191014161547-75a2e0ff0773
github.com/Telmate/proxmox-api-go v0.0.0-20191104165655-ab21e7f8ad14
github.com/hashicorp/terraform v0.12.10
)

2
go.sum
View File

@ -17,6 +17,8 @@ github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022 h1:y8Gs8CzNf
github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=
github.com/Telmate/proxmox-api-go v0.0.0-20191014161547-75a2e0ff0773 h1:DZbCgi+04kVDvo72U+Zazf00VQXt8J2bBn6iuQ1mYUU=
github.com/Telmate/proxmox-api-go v0.0.0-20191014161547-75a2e0ff0773/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Telmate/proxmox-api-go v0.0.0-20191104165655-ab21e7f8ad14 h1:5YRnEl50jAmeO/kZ/LJN/q3oPoXYcCD/IUGZfog5yN8=
github.com/Telmate/proxmox-api-go v0.0.0-20191104165655-ab21e7f8ad14/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=

View File

@ -77,6 +77,10 @@ func resourceVmQemu() *schema.Resource {
ForceNew: true,
Default: true,
},
"hastate": {
Type: schema.TypeString,
Optional: true,
},
"qemu_os": {
Type: schema.TypeString,
Optional: true,
@ -442,6 +446,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
Scsihw: d.Get("scsihw").(string),
HaState: d.Get("hastate").(string),
QemuOs: d.Get("qemu_os").(string),
QemuNetworks: qemuNetworks,
QemuDisks: qemuDisks,
@ -615,6 +620,7 @@ func resourceVmQemuUpdate(d *schema.ResourceData, meta interface{}) error {
QemuNuma: d.Get("numa").(bool),
Hotplug: d.Get("hotplug").(string),
Scsihw: d.Get("scsihw").(string),
HaState: d.Get("hastate").(string),
QemuOs: d.Get("qemu_os").(string),
QemuNetworks: qemuNetworks,
QemuDisks: qemuDisks,
@ -712,6 +718,7 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
d.Set("numa", config.QemuNuma)
d.Set("hotplug", config.Hotplug)
d.Set("scsihw", config.Scsihw)
d.Set("hastate", vmr.HaState())
d.Set("qemu_os", config.QemuOs)
// Cloud-init.
d.Set("ciuser", config.CIuser)