From 7e34d7854e01ff46ff962ffb3ca8b097a59d88be 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 19e37f1e44504..65ddbc448b29c 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 @@ -613,13 +613,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 dfd2dc0c220d6..25a452e92dee9 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 @@ -700,13 +700,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), - }, + } } }