mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-05 13:33:58 +00:00
fix(vm): explicitly allow ""
as a value for CloudInit interfaces (#546)
The CloudInit interface can be left empty in order to allow autodetection of the drive being used. However, it would seem that this value was causing problems (see #539). This commit adds an additional validator for CloudInit interfaces which allows the `""` value.
This commit is contained in:
parent
13326bbd33
commit
0233053dd8
@ -253,6 +253,18 @@ func IDEInterface() schema.SchemaValidateDiagFunc {
|
|||||||
}, false))
|
}, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloudInitInterface is a schema validation function that accepts either an IDE interface identifier or an
|
||||||
|
// empty string, which is used as the default and means "detect which interface should be used automatically".
|
||||||
|
func CloudInitInterface() schema.SchemaValidateDiagFunc {
|
||||||
|
return validation.ToDiagFunc(validation.StringInSlice([]string{
|
||||||
|
"",
|
||||||
|
"ide0",
|
||||||
|
"ide1",
|
||||||
|
"ide2",
|
||||||
|
"ide3",
|
||||||
|
}, false))
|
||||||
|
}
|
||||||
|
|
||||||
// CloudInitType is a schema validation function for cloud-init types.
|
// CloudInitType is a schema validation function for cloud-init types.
|
||||||
func CloudInitType() schema.SchemaValidateDiagFunc {
|
func CloudInitType() schema.SchemaValidateDiagFunc {
|
||||||
return validation.ToDiagFunc(validation.StringInSlice([]string{
|
return validation.ToDiagFunc(validation.StringInSlice([]string{
|
||||||
|
@ -795,7 +795,7 @@ func VM() *schema.Resource {
|
|||||||
Description: "The IDE interface on which the CloudInit drive will be added",
|
Description: "The IDE interface on which the CloudInit drive will be added",
|
||||||
Optional: true,
|
Optional: true,
|
||||||
Default: dvResourceVirtualEnvironmentVMInitializationInterface,
|
Default: dvResourceVirtualEnvironmentVMInitializationInterface,
|
||||||
ValidateDiagFunc: validator.IDEInterface(),
|
ValidateDiagFunc: validator.CloudInitInterface(),
|
||||||
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
|
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool {
|
||||||
return newValue == ""
|
return newValue == ""
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user