From f657fec65be17cb7312e67a44aca6623246fdc15 Mon Sep 17 00:00:00 2001 From: njucz Date: Fri, 20 Nov 2020 10:28:47 +0800 Subject: [PATCH] check all fields nil and return `[]interface{}{}` in flatten func --- .../services/appplatform/spring_cloud_service_resource.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/azurerm/internal/services/appplatform/spring_cloud_service_resource.go b/azurerm/internal/services/appplatform/spring_cloud_service_resource.go index 232d0f9bcfbcd..2c4565ec26a2b 100644 --- a/azurerm/internal/services/appplatform/spring_cloud_service_resource.go +++ b/azurerm/internal/services/appplatform/spring_cloud_service_resource.go @@ -69,7 +69,6 @@ func resourceArmSpringCloudService() *schema.Resource { "network": { Type: schema.TypeList, Optional: true, - Computed: true, ForceNew: true, MaxItems: 1, Elem: &schema.Resource{ @@ -819,6 +818,10 @@ func flattenArmSpringCloudNetwork(input *appplatform.NetworkProfile) []interface appNetworkResourceGroup = *input.AppNetworkResourceGroup } + if serviceRuntimeSubnetID == "" && appSubnetID == "" && serviceRuntimeNetworkResourceGroup == "" && appNetworkResourceGroup == "" && len(cidrRanges) == 0 { + return []interface{}{} + } + return []interface{}{ map[string]interface{}{ "app_subnet_id": appSubnetID,