From 9851b65dbd59972666f94680088f697b96ff161a Mon Sep 17 00:00:00 2001 From: Saad Malik Date: Thu, 28 Jan 2021 11:20:40 -0800 Subject: [PATCH] new fix --- spectrocloud/resource_cluster_vsphere.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spectrocloud/resource_cluster_vsphere.go b/spectrocloud/resource_cluster_vsphere.go index df1e0a32..755a4625 100644 --- a/spectrocloud/resource_cluster_vsphere.go +++ b/spectrocloud/resource_cluster_vsphere.go @@ -379,6 +379,16 @@ func resourceClusterVsphereUpdate(ctx context.Context, d *schema.ResourceData, m err = c.CreateMachinePoolVsphere(cloudConfigId, machinePool) } else if hash != resourceMachinePoolVsphereHash(oldMachinePool) { log.Printf("Change in machine pool %s", name) + oldMachinePool := toMachinePoolVsphere(oldMachinePool) + oldPlacements := oldMachinePool.CloudConfig.Placements + + // set the placement ids + for i, p := range machinePool.CloudConfig.Placements { + if len(oldPlacements) > i { + p.UID = oldPlacements[i].UID + } + } + err = c.UpdateMachinePoolVsphere(cloudConfigId, machinePool) }