Skip to content

Commit 84ddd16

Browse files
authored
Wait for longer for ServiceAccounts to be ready (#105)
closes: #104
1 parent cf22ada commit 84ddd16

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cloud/resource_service_account.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ func resourceServiceAccount() *schema.Resource {
8686
Computed: true,
8787
},
8888
},
89+
Timeouts: &schema.ResourceTimeout{
90+
Create: schema.DefaultTimeout(30 * time.Minute),
91+
Delete: schema.DefaultTimeout(30 * time.Minute),
92+
},
8993
}
9094
}
9195

@@ -166,8 +170,11 @@ func resourceServiceAccountCreate(ctx context.Context, d *schema.ResourceData, m
166170
_ = d.Set("private_key_data", privateKeyData)
167171
d.SetId(fmt.Sprintf("%s/%s", serviceAccount.Namespace, serviceAccount.Name))
168172
}
169-
// Don't retry too frequently to avoid affecting the api-server.
170-
err = retry.RetryContext(ctx, 5*time.Second, func() *retry.RetryError {
173+
174+
err = retry.RetryContext(ctx, d.Timeout(schema.TimeoutCreate), func() *retry.RetryError {
175+
//Sleep 20 seconds between checks so we don't overload the API
176+
time.Sleep(time.Second * 20)
177+
171178
dia := resourceServiceAccountRead(ctx, d, meta)
172179
if dia.HasError() {
173180
return retry.NonRetryableError(fmt.Errorf("ERROR_RETRY_CREATE_SERVICE_ACCOUNT: %s", dia[0].Summary))

0 commit comments

Comments
 (0)