Merge pull request #6355 from godmodelabs/vsphere-disable-customization
provider/vsphere: Add setting to skip customization
This commit is contained in:
commit
9c85c2ed47
|
@ -84,6 +84,7 @@ type virtualMachine struct {
|
||||||
dnsServers []string
|
dnsServers []string
|
||||||
bootableVmdk bool
|
bootableVmdk bool
|
||||||
linkedClone bool
|
linkedClone bool
|
||||||
|
skipCustomization bool
|
||||||
windowsOptionalConfig windowsOptConfig
|
windowsOptionalConfig windowsOptConfig
|
||||||
customConfigurations map[string](types.AnyType)
|
customConfigurations map[string](types.AnyType)
|
||||||
}
|
}
|
||||||
|
@ -196,6 +197,13 @@ func resourceVSphereVirtualMachine() *schema.Resource {
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"skip_customization": &schema.Schema{
|
||||||
|
Type: schema.TypeBool,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
Default: false,
|
||||||
|
},
|
||||||
|
|
||||||
"custom_configuration_parameters": &schema.Schema{
|
"custom_configuration_parameters": &schema.Schema{
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -437,6 +445,10 @@ func resourceVSphereVirtualMachineCreate(d *schema.ResourceData, meta interface{
|
||||||
vm.linkedClone = v.(bool)
|
vm.linkedClone = v.(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := d.GetOk("skip_customization"); ok {
|
||||||
|
vm.skipCustomization = v.(bool)
|
||||||
|
}
|
||||||
|
|
||||||
if raw, ok := d.GetOk("dns_suffixes"); ok {
|
if raw, ok := d.GetOk("dns_suffixes"); ok {
|
||||||
for _, v := range raw.([]interface{}) {
|
for _, v := range raw.([]interface{}) {
|
||||||
vm.dnsSuffixes = append(vm.dnsSuffixes, v.(string))
|
vm.dnsSuffixes = append(vm.dnsSuffixes, v.(string))
|
||||||
|
@ -1575,16 +1587,20 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if vm.skipCustomization {
|
||||||
|
log.Printf("[DEBUG] VM customization skipped")
|
||||||
|
} else {
|
||||||
|
log.Printf("[DEBUG] VM customization starting")
|
||||||
taskb, err := newVM.Customize(context.TODO(), customSpec)
|
taskb, err := newVM.Customize(context.TODO(), customSpec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = taskb.WaitForResult(context.TODO(), nil)
|
_, err = taskb.WaitForResult(context.TODO(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("[DEBUG] VM customization finished")
|
log.Printf("[DEBUG] VM customization finished")
|
||||||
|
}
|
||||||
|
|
||||||
for i := 1; i < len(vm.hardDisks); i++ {
|
for i := 1; i < len(vm.hardDisks); i++ {
|
||||||
err = addHardDisk(newVM, vm.hardDisks[i].size, vm.hardDisks[i].iops, vm.hardDisks[i].initType, datastore, vm.hardDisks[i].vmdkPath)
|
err = addHardDisk(newVM, vm.hardDisks[i].size, vm.hardDisks[i].iops, vm.hardDisks[i].initType, datastore, vm.hardDisks[i].vmdkPath)
|
||||||
|
|
|
@ -80,6 +80,7 @@ The following arguments are supported:
|
||||||
* `windows_opt_config` - (Optional) Extra options for clones of Windows machines.
|
* `windows_opt_config` - (Optional) Extra options for clones of Windows machines.
|
||||||
* `linked_clone` - (Optional) Specifies if the new machine is a [linked clone](https://www.vmware.com/support/ws5/doc/ws_clone_overview.html#wp1036396) of another machine or not.
|
* `linked_clone` - (Optional) Specifies if the new machine is a [linked clone](https://www.vmware.com/support/ws5/doc/ws_clone_overview.html#wp1036396) of another machine or not.
|
||||||
* `custom_configuration_parameters` - (Optional) Map of values that is set as virtual machine custom configurations.
|
* `custom_configuration_parameters` - (Optional) Map of values that is set as virtual machine custom configurations.
|
||||||
|
* `skip_customization` - (Optional) skip virtual machine customization (useful if OS is not in the guest OS support matrix of VMware like "other3xLinux64Guest").
|
||||||
|
|
||||||
The `network_interface` block supports:
|
The `network_interface` block supports:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue