Skip to content

Commit

Permalink
Remove missed status check in nodepool (#3374) (#6115)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 14, 2020
1 parent 64b2780 commit 5c3911c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
3 changes: 3 additions & 0 deletions .changelog/3374.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
container: fixed importing/reading `google_container_node_pool` resources in non-RUNNING states
```
18 changes: 2 additions & 16 deletions google/resource_container_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,27 +313,13 @@ func resourceContainerNodePoolCreate(d *schema.ResourceData, meta interface{}) e
func resourceContainerNodePoolRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
nodePoolInfo, err := extractNodePoolInformation(d, config)

name := getNodePoolName(d.Id())

if err != nil {
return err
}

var nodePool = &containerBeta.NodePool{}
err = resource.Retry(2*time.Minute, func() *resource.RetryError {
nodePool, err = config.clientContainerBeta.
Projects.Locations.Clusters.NodePools.Get(nodePoolInfo.fullyQualifiedName(name)).Do()

if err != nil {
return resource.NonRetryableError(err)
}
if nodePool.Status != "RUNNING" {
return resource.RetryableError(fmt.Errorf("Nodepool %q has status %q with message %q", d.Get("name"), nodePool.Status, nodePool.StatusMessage))
}
return nil
})
name := getNodePoolName(d.Id())

nodePool, err := config.clientContainerBeta.Projects.Locations.Clusters.NodePools.Get(nodePoolInfo.fullyQualifiedName(name)).Do()
if err != nil {
return handleNotFoundError(err, d, fmt.Sprintf("NodePool %q from cluster %q", name, nodePoolInfo.cluster))
}
Expand Down

0 comments on commit 5c3911c

Please sign in to comment.