From cee2304ad31caae4a4dd67a75bf815175aac756f Mon Sep 17 00:00:00 2001 From: magodo Date: Tue, 7 Feb 2023 15:08:06 +0800 Subject: [PATCH] `zurerm_service_fabric_managed_cluster` - Fix panic on reading (e.g import) --- .../service_fabric_managed_cluster_resource.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go b/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go index 70bf7143e70b..0372302e3574 100644 --- a/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go +++ b/internal/services/servicefabricmanaged/service_fabric_managed_cluster_resource.go @@ -768,11 +768,17 @@ func flattenNodetypeProperties(nt nodetype.NodeType) NodeType { VmImageVersion: utils.NormalizeNilableString(props.VMImageVersion), VmInstanceCount: props.VMInstanceCount, VmSize: utils.NormalizeNilableString(props.VMSize), - ApplicationPorts: fmt.Sprintf("%d-%d", props.ApplicationPorts.StartPort, props.ApplicationPorts.EndPort), - EphemeralPorts: fmt.Sprintf("%d-%d", props.EphemeralPorts.StartPort, props.EphemeralPorts.EndPort), Id: utils.NormalizeNilableString(nt.Id), } + if appPorts := props.ApplicationPorts; appPorts != nil { + out.ApplicationPorts = fmt.Sprintf("%d-%d", appPorts.StartPort, appPorts.EndPort) + } + + if ephemeralPorts := props.EphemeralPorts; ephemeralPorts != nil { + out.EphemeralPorts = fmt.Sprintf("%d-%d", ephemeralPorts.StartPort, ephemeralPorts.EndPort) + } + if mpg := props.MultiplePlacementGroups; mpg != nil { out.MultiplePlacementGroupsEnabled = *mpg }