diff --git a/go.mod b/go.mod index ae173f66..60de9030 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Telmate/terraform-provider-proxmox go 1.18 require ( - github.com/Telmate/proxmox-api-go v0.0.0-20221101100531-73720ef02c2e + github.com/Telmate/proxmox-api-go v0.0.0-20230111160017-cd4f20323c5c github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1 github.com/rs/zerolog v1.28.0 @@ -36,6 +36,7 @@ require ( github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect github.com/hashicorp/yamux v0.1.1 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -44,6 +45,8 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.1.0 // indirect + github.com/spf13/cobra v1.5.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect github.com/vmihailenco/tagparser v0.1.2 // indirect diff --git a/go.sum b/go.sum index 879fe957..d9cf3fc6 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C6 github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= github.com/Telmate/proxmox-api-go v0.0.0-20221101100531-73720ef02c2e h1:nqS6OrumRNwzIl/N+dhHNjKdEXrkqlAuyQvRMRVdbv4= github.com/Telmate/proxmox-api-go v0.0.0-20221101100531-73720ef02c2e/go.mod h1:zQ/B1nkMv6ueUlAEr0D/x5eaFe3rHSScuTc08dcvvPI= +github.com/Telmate/proxmox-api-go v0.0.0-20230111160017-cd4f20323c5c h1:PTYbdF49n/jqdhSZ647Kj/c4eEJMpAk7Vmn3Sl13Xbw= +github.com/Telmate/proxmox-api-go v0.0.0-20230111160017-cd4f20323c5c/go.mod h1:zQ/B1nkMv6ueUlAEr0D/x5eaFe3rHSScuTc08dcvvPI= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= @@ -20,6 +22,7 @@ github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6 github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -101,6 +104,9 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= @@ -149,10 +155,15 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -251,6 +262,7 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/proxmox/resource_vm_qemu.go b/proxmox/resource_vm_qemu.go index a21fd232..58800ba4 100755 --- a/proxmox/resource_vm_qemu.go +++ b/proxmox/resource_vm_qemu.go @@ -900,22 +900,24 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error { Searchdomain: d.Get("searchdomain").(string), Nameserver: d.Get("nameserver").(string), Sshkeys: d.Get("sshkeys").(string), - Ipconfig0: d.Get("ipconfig0").(string), - Ipconfig1: d.Get("ipconfig1").(string), - Ipconfig2: d.Get("ipconfig2").(string), - Ipconfig3: d.Get("ipconfig3").(string), - Ipconfig4: d.Get("ipconfig4").(string), - Ipconfig5: d.Get("ipconfig5").(string), - Ipconfig6: d.Get("ipconfig6").(string), - Ipconfig7: d.Get("ipconfig7").(string), - Ipconfig8: d.Get("ipconfig8").(string), - Ipconfig9: d.Get("ipconfig9").(string), - Ipconfig10: d.Get("ipconfig10").(string), - Ipconfig11: d.Get("ipconfig11").(string), - Ipconfig12: d.Get("ipconfig12").(string), - Ipconfig13: d.Get("ipconfig13").(string), - Ipconfig14: d.Get("ipconfig14").(string), - Ipconfig15: d.Get("ipconfig15").(string), + Ipconfig: pxapi.IpconfigMap{ + 0: d.Get("ipconfig0").(string), + 1: d.Get("ipconfig1").(string), + 2: d.Get("ipconfig2").(string), + 3: d.Get("ipconfig3").(string), + 4: d.Get("ipconfig4").(string), + 5: d.Get("ipconfig5").(string), + 6: d.Get("ipconfig6").(string), + 7: d.Get("ipconfig7").(string), + 8: d.Get("ipconfig8").(string), + 9: d.Get("ipconfig9").(string), + 10: d.Get("ipconfig10").(string), + 11: d.Get("ipconfig11").(string), + 12: d.Get("ipconfig12").(string), + 13: d.Get("ipconfig13").(string), + 14: d.Get("ipconfig14").(string), + 15: d.Get("ipconfig15").(string), + }, } if len(qemuVgaList) > 0 { config.QemuVga = qemuVgaList[0].(map[string]interface{}) @@ -1218,22 +1220,24 @@ func resourceVmQemuUpdate(ctx context.Context, d *schema.ResourceData, meta inte Searchdomain: d.Get("searchdomain").(string), Nameserver: d.Get("nameserver").(string), Sshkeys: d.Get("sshkeys").(string), - Ipconfig0: d.Get("ipconfig0").(string), - Ipconfig1: d.Get("ipconfig1").(string), - Ipconfig2: d.Get("ipconfig2").(string), - Ipconfig3: d.Get("ipconfig3").(string), - Ipconfig4: d.Get("ipconfig4").(string), - Ipconfig5: d.Get("ipconfig5").(string), - Ipconfig6: d.Get("ipconfig6").(string), - Ipconfig7: d.Get("ipconfig7").(string), - Ipconfig8: d.Get("ipconfig8").(string), - Ipconfig9: d.Get("ipconfig9").(string), - Ipconfig10: d.Get("ipconfig10").(string), - Ipconfig11: d.Get("ipconfig11").(string), - Ipconfig12: d.Get("ipconfig12").(string), - Ipconfig13: d.Get("ipconfig13").(string), - Ipconfig14: d.Get("ipconfig14").(string), - Ipconfig15: d.Get("ipconfig15").(string), + Ipconfig: pxapi.IpconfigMap{ + 0: d.Get("ipconfig0").(string), + 1: d.Get("ipconfig1").(string), + 2: d.Get("ipconfig2").(string), + 3: d.Get("ipconfig3").(string), + 4: d.Get("ipconfig4").(string), + 5: d.Get("ipconfig5").(string), + 6: d.Get("ipconfig6").(string), + 7: d.Get("ipconfig7").(string), + 8: d.Get("ipconfig8").(string), + 9: d.Get("ipconfig9").(string), + 10: d.Get("ipconfig10").(string), + 11: d.Get("ipconfig11").(string), + 12: d.Get("ipconfig12").(string), + 13: d.Get("ipconfig13").(string), + 14: d.Get("ipconfig14").(string), + 15: d.Get("ipconfig15").(string), + }, } if len(qemuVgaList) > 0 { config.QemuVga = qemuVgaList[0].(map[string]interface{}) @@ -1537,22 +1541,22 @@ func _resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error { d.Set("searchdomain", config.Searchdomain) d.Set("nameserver", config.Nameserver) d.Set("sshkeys", config.Sshkeys) - d.Set("ipconfig0", config.Ipconfig0) - d.Set("ipconfig1", config.Ipconfig1) - d.Set("ipconfig2", config.Ipconfig2) - d.Set("ipconfig3", config.Ipconfig3) - d.Set("ipconfig4", config.Ipconfig4) - d.Set("ipconfig5", config.Ipconfig5) - d.Set("ipconfig6", config.Ipconfig6) - d.Set("ipconfig7", config.Ipconfig7) - d.Set("ipconfig8", config.Ipconfig8) - d.Set("ipconfig9", config.Ipconfig9) - d.Set("ipconfig10", config.Ipconfig10) - d.Set("ipconfig11", config.Ipconfig11) - d.Set("ipconfig12", config.Ipconfig12) - d.Set("ipconfig13", config.Ipconfig13) - d.Set("ipconfig14", config.Ipconfig14) - d.Set("ipconfig15", config.Ipconfig15) + d.Set("ipconfig0", config.Ipconfig[0]) + d.Set("ipconfig1", config.Ipconfig[1]) + d.Set("ipconfig2", config.Ipconfig[2]) + d.Set("ipconfig3", config.Ipconfig[3]) + d.Set("ipconfig4", config.Ipconfig[4]) + d.Set("ipconfig5", config.Ipconfig[5]) + d.Set("ipconfig6", config.Ipconfig[6]) + d.Set("ipconfig7", config.Ipconfig[7]) + d.Set("ipconfig8", config.Ipconfig[8]) + d.Set("ipconfig9", config.Ipconfig[9]) + d.Set("ipconfig10", config.Ipconfig[10]) + d.Set("ipconfig11", config.Ipconfig[11]) + d.Set("ipconfig12", config.Ipconfig[12]) + d.Set("ipconfig13", config.Ipconfig[13]) + d.Set("ipconfig14", config.Ipconfig[14]) + d.Set("ipconfig15", config.Ipconfig[15]) // Some dirty hacks to populate undefined keys with default values. checkedKeys := []string{"force_create", "define_connection_info", "oncreate"}