mirror of
https://github.com/Telmate/terraform-provider-proxmox.git
synced 2025-12-18 22:46:04 -05:00
add validation to vm_qemu name field (#858)
* add validation to vm_qemu name field * changed some stuff and forgot to re-test the build. fixed now
This commit is contained in:
parent
eca98dc58c
commit
bdb1f9fdf9
2 changed files with 11 additions and 2 deletions
|
|
@ -21,8 +21,6 @@ Follow this [install guide](docs/guides/installation.md) to install the plugin.
|
|||
* `proxmox_vm_qemu`.`disk`.`size` attribute does not match what is displayed in the Proxmox UI.
|
||||
* Updates to `proxmox_vm_qemu` resources almost always result as a failed task within the Proxmox UI. This appears to be
|
||||
harmless and the desired configuration changes do get applied.
|
||||
* `proxmox_vm_qemu` does not (yet) validate vm names, be sure to only use alphanumeric and dashes otherwise you may get
|
||||
an opaque 400 Parameter Verification failed (indicating a bad value was sent to proxmox).
|
||||
* When using the `proxmox_lxc` resource, the provider will crash unless `rootfs` is defined.
|
||||
* When using the Network Boot mode (PXE), a valid NIC must be defined for the VM, and the boot order must specify network first.
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,17 @@ func resourceVmQemu() *schema.Resource {
|
|||
Optional: true,
|
||||
// Default: "",
|
||||
Description: "The VM name",
|
||||
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
|
||||
v := val.(string)
|
||||
matched, err := regexp.Match("[^a-zA-Z0-9-]", []byte(v))
|
||||
if err != nil {
|
||||
warns = append(warns, fmt.Sprintf("%q, had an error running regexp.Match err=[%v]", key, err))
|
||||
}
|
||||
if matched {
|
||||
errs = append(errs, fmt.Errorf("%q, must be contain only alphanumerics and hyphens", key, v))
|
||||
}
|
||||
return
|
||||
},
|
||||
},
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
|
|
|
|||
Loading…
Reference in a new issue