Skip to content

Commit

Permalink
call WorkerPoolUpdate at the end of create (IBM-Cloud#4377)
Browse files Browse the repository at this point in the history
* call WorkerPoolUpdate at the end of create

* check for new resource in WorkerPoolUpdate

---------

Co-authored-by: Zoltan Illes <zoltan.illes@ibm.com>
  • Loading branch information
2 people authored and IBM-diksha committed Mar 17, 2023
1 parent 0f48a94 commit 0e0dc12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ibm/service/kubernetes/resource_ibm_container_worker_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func resourceIBMContainerWorkerPoolCreate(d *schema.ResourceData, meta interface

d.SetId(fmt.Sprintf("%s/%s", clusterNameorID, res.ID))

return resourceIBMContainerWorkerPoolRead(d, meta)
return resourceIBMContainerWorkerPoolUpdate(d, meta)
}

func resourceIBMContainerWorkerPoolRead(d *schema.ResourceData, meta interface{}) error {
Expand Down Expand Up @@ -351,7 +351,7 @@ func resourceIBMContainerWorkerPoolUpdate(d *schema.ResourceData, meta interface
return err
}

if d.HasChange("size_per_zone") {
if d.HasChange("size_per_zone") && !d.IsNewResource() {
err = workerPoolsAPI.ResizeWorkerPool(clusterNameorID, workerPoolNameorID, d.Get("size_per_zone").(int), targetEnv)
if err != nil {
return err
Expand All @@ -362,7 +362,7 @@ func resourceIBMContainerWorkerPoolUpdate(d *schema.ResourceData, meta interface
return fmt.Errorf("[ERROR] Error waiting for workers of worker pool (%s) of cluster (%s) to become ready: %s", workerPoolNameorID, clusterNameorID, err)
}
}
if d.HasChange("labels") {
if d.HasChange("labels") && !d.IsNewResource() {
labels := make(map[string]string)
if l, ok := d.GetOk("labels"); ok {
for k, v := range l.(map[string]interface{}) {
Expand Down

0 comments on commit 0e0dc12

Please sign in to comment.