From a89b4762e702cadfe7a59295d9028bc652d7ba39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20J=2E=20Nu=C3=B1ez=20Madrazo?= Date: Tue, 2 Nov 2021 22:51:04 +0000 Subject: [PATCH] Fix error introduce in the last release Close #104 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro J. Nuñez Madrazo --- civo/resource_kubernetes_cluster.go | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/civo/resource_kubernetes_cluster.go b/civo/resource_kubernetes_cluster.go index fa255d22..99c755d4 100644 --- a/civo/resource_kubernetes_cluster.go +++ b/civo/resource_kubernetes_cluster.go @@ -185,6 +185,11 @@ func nodePoolSchema() *schema.Schema { Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + Description: "Nodepool ID", + }, "count": { Type: schema.TypeInt, Computed: true, @@ -543,6 +548,7 @@ func flattenInstances(instances []civogo.KubernetesInstance) []interface{} { // function to flatten all instances inside the cluster func flattenNodePool(cluster *civogo.KubernetesCluster) []interface{} { + if cluster.Pools == nil { return nil } @@ -552,14 +558,12 @@ func flattenNodePool(cluster *civogo.KubernetesCluster) []interface{} { flattenedPoolInstance := make([]interface{}, 0) for _, v := range pool.Instances { - instanceData := searchInstance(cluster.Instances, v.Hostname) - rawPoolInstance := map[string]interface{}{ "hostname": v.Hostname, "size": pool.Size, - "cpu_cores": instanceData.CPUCores, - "ram_mb": instanceData.RAMMegabytes, - "disk_gb": instanceData.DiskGigabytes, + "cpu_cores": v.CPUCores, + "ram_mb": v.RAMMegabytes, + "disk_gb": v.DiskGigabytes, "status": v.Status, "tags": v.Tags, } @@ -601,13 +605,4 @@ func flattenInstalledApplication(apps []civogo.KubernetesInstalledApplication) [ } return flattenedInstalledApplication -} - -func searchInstance(instanceList []civogo.KubernetesInstance, hostname string) civogo.KubernetesInstance { - for _, v := range instanceList { - if strings.Contains(v.Hostname, hostname) { - return v - } - } - return civogo.KubernetesInstance{} -} +} \ No newline at end of file