Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new vmID option #143

Merged
merged 1 commit into from
Feb 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions proxmox/resource_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ func resourceLxc() *schema.Resource {
Required: true,
ForceNew: true,
},
"vmid": {
Type: schema.TypeInt,
Optional: true,
Default: 0,
},
},
}
}
Expand Down Expand Up @@ -377,10 +382,16 @@ func resourceLxcCreate(d *schema.ResourceData, meta interface{}) error {

// get unique id
nextid, err := nextVmId(pconf)
if err != nil {
pmParallelEnd(pconf)
return err
vmID := d.Get("vmid").(int)
if vmID != 0 {
nextid = vmID
} else {
if err != nil {
pmParallelEnd(pconf)
return err
}
}

vmr := pxapi.NewVmRef(nextid)
vmr.SetNode(targetNode)
err = config.CreateLxc(vmr, client)
Expand Down