Retry creation of Cloud IoT registry (#1713)

This can fail with 503, which is a transient error.
This commit is contained in:
Rodrigo Queiro 2018-06-28 01:49:09 +02:00 committed by Dana Hoffman
parent ae39b9fafb
commit 4a41eaad77

View File

@ -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