Skip to content

Commit e8ffe89

Browse files
Extra error handling for node pools that don't match instance manager pattern. (#1149)
1 parent 142ac79 commit e8ffe89

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

google/resource_container_node_pool.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,12 @@ func flattenNodePool(d *schema.ResourceData, config *Config, np *container.NodeP
368368
for _, url := range np.InstanceGroupUrls {
369369
// retrieve instance group manager (InstanceGroupUrls are actually URLs for InstanceGroupManagers)
370370
matches := instanceGroupManagerURL.FindStringSubmatch(url)
371+
if len(matches) < 4 {
372+
return nil, fmt.Errorf("Error reading instance group manage URL '%q'", url)
373+
}
371374
igm, err := config.clientCompute.InstanceGroupManagers.Get(matches[1], matches[2], matches[3]).Do()
372375
if err != nil {
373-
return nil, fmt.Errorf("Error reading instance group manager returned as an instance group URL: %s", err)
376+
return nil, fmt.Errorf("Error reading instance group manager returned as an instance group URL: %q", err)
374377
}
375378
size += int(igm.TargetSize)
376379
}

0 commit comments

Comments
 (0)