mirror of
https://github.com/letic/terraform-provider-proxmox.git
synced 2024-07-03 08:02:39 +00:00
add pool to qemu resource
This commit is contained in:
parent
06d6363421
commit
b734e7888f
|
@ -342,6 +342,10 @@ func resourceVmQemu() *schema.Resource {
|
||||||
Default: true,
|
Default: true,
|
||||||
ConflictsWith: []string{"ssh_forward_ip", "ssh_user", "ssh_private_key", "os_type", "os_network_config"},
|
ConflictsWith: []string{"ssh_forward_ip", "ssh_user", "ssh_private_key", "os_type", "os_network_config"},
|
||||||
},
|
},
|
||||||
|
"pool": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,6 +395,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
forceCreate := d.Get("force_create").(bool)
|
forceCreate := d.Get("force_create").(bool)
|
||||||
targetNode := d.Get("target_node").(string)
|
targetNode := d.Get("target_node").(string)
|
||||||
|
pool := d.Get("pool").(string)
|
||||||
|
|
||||||
if dupVmr != nil && forceCreate {
|
if dupVmr != nil && forceCreate {
|
||||||
pmParallelEnd(pconf)
|
pmParallelEnd(pconf)
|
||||||
|
@ -411,7 +416,12 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
}
|
}
|
||||||
vmr = pxapi.NewVmRef(nextid)
|
vmr = pxapi.NewVmRef(nextid)
|
||||||
|
|
||||||
|
// set target node and pool
|
||||||
vmr.SetNode(targetNode)
|
vmr.SetNode(targetNode)
|
||||||
|
if pool != "" {
|
||||||
|
vmr.SetPool(pool)
|
||||||
|
}
|
||||||
|
|
||||||
// check if ISO or clone
|
// check if ISO or clone
|
||||||
if d.Get("clone").(string) != "" {
|
if d.Get("clone").(string) != "" {
|
||||||
sourceVmr, err := client.GetVmRefByName(d.Get("clone").(string))
|
sourceVmr, err := client.GetVmRefByName(d.Get("clone").(string))
|
||||||
|
@ -630,6 +640,7 @@ func resourceVmQemuRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
d.Set("bridge", config.QemuBrige)
|
d.Set("bridge", config.QemuBrige)
|
||||||
d.Set("vlan", config.QemuVlanTag)
|
d.Set("vlan", config.QemuVlanTag)
|
||||||
d.Set("mac", config.QemuMacAddr)
|
d.Set("mac", config.QemuMacAddr)
|
||||||
|
d.Set("pool", vmr.Pool())
|
||||||
|
|
||||||
pmParallelEnd(pconf)
|
pmParallelEnd(pconf)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user