Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,21 @@ func (r ApplicationRegistrationResource) Create() sdk.ResourceFunc {
id := stable.NewApplicationID(*app.Id)
metadata.SetID(id)

// Wait for the application to be replicated before proceeding
// This prevents "Resource does not exist" errors when using Service Principal authentication
if err = consistency.WaitForUpdate(ctx, func(ctx context.Context) (*bool, error) {
resp, err := client.GetApplication(ctx, id, application.DefaultGetApplicationOperationOptions())
if err != nil {
if response.WasNotFound(resp.HttpResponse) {
return pointer.To(false), nil
}
return nil, err
}
return pointer.To(resp.Model != nil), nil
}); err != nil {
return fmt.Errorf("waiting for replication of %s: %+v", id, err)
}

return nil
},
}
Expand Down