Skip to content

Commit

Permalink
Retry creation of Cloud IoT registry (#1713)
Browse files Browse the repository at this point in the history
This can fail with 503, which is a transient error.
  • Loading branch information
drigz authored and danawillow committed Jun 27, 2018
1 parent ae39b9f commit 4a41eaa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion google/resource_cloudiot_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ func resourceCloudIoTRegistryCreate(d *schema.ResourceData, meta interface{}) er
registryId := fmt.Sprintf("%s/registries/%s", parent, deviceRegistry.Id)
d.SetId(registryId)

_, err = config.clientCloudIoT.Projects.Locations.Registries.Create(parent, deviceRegistry).Do()
err = retryTime(func() error {
_, err := config.clientCloudIoT.Projects.Locations.Registries.Create(parent, deviceRegistry).Do()
return err
}, 5)
if err != nil {
d.SetId("")
return err
Expand Down

0 comments on commit 4a41eaa

Please sign in to comment.