From 41135bd24e486093999d58d46d1ce7d569465e6e Mon Sep 17 00:00:00 2001 From: arcturusZhang Date: Fri, 17 Jan 2020 15:29:45 +0800 Subject: [PATCH] Escape health probe when health probe is empty --- .../resource_arm_linux_virtual_machine_scale_set.go | 10 ++++++---- .../resource_arm_windows_virtual_machine_scale_set.go | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/azurerm/internal/services/compute/resource_arm_linux_virtual_machine_scale_set.go b/azurerm/internal/services/compute/resource_arm_linux_virtual_machine_scale_set.go index 5166a5e9ec348..b87895f5b3195 100644 --- a/azurerm/internal/services/compute/resource_arm_linux_virtual_machine_scale_set.go +++ b/azurerm/internal/services/compute/resource_arm_linux_virtual_machine_scale_set.go @@ -647,13 +647,15 @@ func resourceArmLinuxVirtualMachineScaleSetUpdate(d *schema.ResourceData, meta i return fmt.Errorf("Error expanding `network_interface`: %+v", err) } - healthProbeId := d.Get("health_probe_id").(string) - updateProps.VirtualMachineProfile.NetworkProfile = &compute.VirtualMachineScaleSetUpdateNetworkProfile{ NetworkInterfaceConfigurations: networkInterfaces, - HealthProbe: &compute.APIEntityReference{ + } + + healthProbeId := d.Get("health_probe_id").(string) + if healthProbeId != "" { + updateProps.VirtualMachineProfile.NetworkProfile.HealthProbe = &compute.APIEntityReference{ ID: utils.String(healthProbeId), - }, + } } } diff --git a/azurerm/internal/services/compute/resource_arm_windows_virtual_machine_scale_set.go b/azurerm/internal/services/compute/resource_arm_windows_virtual_machine_scale_set.go index 89efbc67eaa44..c56f617aa5821 100644 --- a/azurerm/internal/services/compute/resource_arm_windows_virtual_machine_scale_set.go +++ b/azurerm/internal/services/compute/resource_arm_windows_virtual_machine_scale_set.go @@ -738,13 +738,15 @@ func resourceArmWindowsVirtualMachineScaleSetUpdate(d *schema.ResourceData, meta return fmt.Errorf("Error expanding `network_interface`: %+v", err) } - healthProbeId := d.Get("health_probe_id").(string) - updateProps.VirtualMachineProfile.NetworkProfile = &compute.VirtualMachineScaleSetUpdateNetworkProfile{ NetworkInterfaceConfigurations: networkInterfaces, - HealthProbe: &compute.APIEntityReference{ + } + + healthProbeId := d.Get("health_probe_id").(string) + if healthProbeId != "" { + updateProps.VirtualMachineProfile.NetworkProfile.HealthProbe = &compute.APIEntityReference{ ID: utils.String(healthProbeId), - }, + } } }