Skip to content

Commit

Permalink
allow datastore cluster id for library clones
Browse files Browse the repository at this point in the history
  • Loading branch information
bFekete authored and tenthirtyam committed Apr 30, 2024
1 parent b3eeb8e commit 552a385
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,8 +1014,11 @@ func resourceVSphereVirtualMachineCustomizeDiff(_ context.Context, d *schema.Res
_ = d.SetNew("imported", false)
case d.Id() == "":
if contentlibrary.IsContentLibraryItem(meta.(*Client).restClient, d.Get("clone.0.template_uuid").(string)) {
if _, ok := d.GetOk("datastore_cluster_id"); ok {
return fmt.Errorf("Cannot use datastore_cluster_id with Content Library source")
if ds_cluster_id, ok := d.GetOk("datastore_cluster_id"); ok {
err := d.SetNew("datastore_id", ds_cluster_id.(string))
if err != nil {
return fmt.Errorf("error setting datastore_id: %s", err)
}
}
} else if err := vmworkflow.ValidateVirtualMachineClone(d, client); err != nil {
return err
Expand Down

0 comments on commit 552a385

Please sign in to comment.