From d2f50d868bb2726b123cec21e171da40fc233570 Mon Sep 17 00:00:00 2001 From: Pradeepsingh Bhati Date: Fri, 28 Jan 2022 19:39:43 +0530 Subject: [PATCH] add cluster_reference check before set avoid in case of overlay subnets --- nutanix/data_source_nutanix_subnet.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nutanix/data_source_nutanix_subnet.go b/nutanix/data_source_nutanix_subnet.go index ba4f034d1..c25b99fb4 100644 --- a/nutanix/data_source_nutanix_subnet.go +++ b/nutanix/data_source_nutanix_subnet.go @@ -415,7 +415,11 @@ func dataSourceNutanixSubnetRead(d *schema.ResourceData, meta interface{}) error return err } - d.Set("cluster_reference_name", utils.StringValue(resp.Status.ClusterReference.Name)) + //cluster reference is not there for overlay subnet + if resp.Status.ClusterReference != nil { + d.Set("cluster_reference_name", utils.StringValue(resp.Status.ClusterReference.Name)) + } + d.Set("api_version", utils.StringValue(resp.APIVersion)) d.Set("name", utils.StringValue(resp.Status.Name)) d.Set("description", utils.StringValue(resp.Status.Description))