You must remain a resident of Canada until the home is bought or built.
Even if you are a non-resident now, you might plan to return to Canada. To use the HBP upon your return, you must qualify as a "first-time buyer." This means that in the four-year period before your withdrawal, you did not occupy a home that you or your current spouse/common-law partner owned. Your time spent abroad as a non-resident counts toward this four-year window. Summary of Risks
You must be a resident of Canada.