Skip to content

Commit

Permalink
handle cluster import
Browse files Browse the repository at this point in the history
Handle import for cluster with zero workers in default worker pool
  • Loading branch information
Praveengostu authored and hkantare committed Aug 10, 2018
1 parent dfbc930 commit f2583d7
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions ibm/resource_ibm_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,18 @@ func resourceIBMContainerClusterRead(d *schema.ResourceData, meta interface{}) e
return fmt.Errorf("Error retrieving workers of default worker pool for cluster: %s", err)
}

hardware := workersByPool[0].Isolation
switch strings.ToLower(hardware) {
case "":
hardware = hardwareShared
case isolationPrivate:
hardware = hardwareDedicated
case isolationPublic:
hardware = hardwareShared
if len(workersByPool) > 0 {
hardware := workersByPool[0].Isolation
switch strings.ToLower(hardware) {
case "":
hardware = hardwareShared
case isolationPrivate:
hardware = hardwareDedicated
case isolationPublic:
hardware = hardwareShared
}
d.Set("isolation", workersByPool[0].Isolation)
d.Set("hardware", hardware)
}

defaultWorkerPool, err := workerPoolsAPI.GetWorkerPool(clusterID, defaultWorkerPool, targetEnv)
Expand All @@ -510,8 +514,6 @@ func resourceIBMContainerClusterRead(d *schema.ResourceData, meta interface{}) e
}
}
d.Set("worker_pools", flattenWorkerPools(workerPools))
d.Set("hardware", hardware)
d.Set("isolation", workersByPool[0].Isolation)
}

albs, err := albsAPI.ListClusterALBs(clusterID, targetEnv)
Expand Down

0 comments on commit f2583d7

Please sign in to comment.