Skip to content

Commit

Permalink
Check if nodepool created before returning error (#5225) (#3646)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Sep 22, 2021
1 parent 72be07a commit 7b4e580
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/5225.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
container: fixed an issue where a node pool created with error (eg. GKE_STOCKOUT) would not be captured in state
```
11 changes: 8 additions & 3 deletions google-beta/resource_container_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,14 @@ func resourceContainerNodePoolCreate(d *schema.ResourceData, meta interface{}) e
default:
// leaving default case to ensure this is non blocking
}
// The resource didn't actually create
d.SetId("")
return waitErr
// Check if resource was created but apply timed out.
// Common cause for that is GCE_STOCKOUT which will wait for resources and return error after timeout,
// but in fact nodepool will be created so we have to capture that in state.
_, err = clusterNodePoolsGetCall.Do()
if err != nil {
d.SetId("")
return waitErr
}
}

log.Printf("[INFO] GKE NodePool %s has been created", nodePool.Name)
Expand Down

0 comments on commit 7b4e580

Please sign in to comment.