From 02c0243453dfa239ea38fe50acb27feafd0d7dfa Mon Sep 17 00:00:00 2001 From: hezijie Date: Mon, 22 May 2023 09:34:42 +0800 Subject: [PATCH] try to fix potential nil panic --- .../containers/kubernetes_cluster_data_source.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/services/containers/kubernetes_cluster_data_source.go b/internal/services/containers/kubernetes_cluster_data_source.go index dcc5279b968f..1ee3a5ab5fbe 100644 --- a/internal/services/containers/kubernetes_cluster_data_source.go +++ b/internal/services/containers/kubernetes_cluster_data_source.go @@ -886,27 +886,27 @@ func flattenKubernetesClusterDataSourceStorageProfile(input *managedclusters.Man if input != nil { blobEnabled := false - if input.BlobCSIDriver != nil { + if input.BlobCSIDriver != nil && input.BlobCSIDriver.Enabled != nil { blobEnabled = *input.BlobCSIDriver.Enabled } diskEnabled := true - if input.DiskCSIDriver != nil { + if input.DiskCSIDriver != nil && input.DiskCSIDriver.Enabled != nil { diskEnabled = *input.DiskCSIDriver.Enabled } diskVersion := "" - if input.DiskCSIDriver != nil { + if input.DiskCSIDriver != nil && input.DiskCSIDriver.Version != nil { diskVersion = *input.DiskCSIDriver.Version } fileEnabled := true - if input.FileCSIDriver != nil { + if input.FileCSIDriver != nil && input.FileCSIDriver.Enabled != nil { fileEnabled = *input.FileCSIDriver.Enabled } snapshotController := true - if input.SnapshotController != nil { + if input.SnapshotController != nil && input.SnapshotController.Enabled != nil { snapshotController = *input.SnapshotController.Enabled }