Your question may not be as simple as presented........
There may be other factors that need to be considered including:
1. your personal family needs
3. proximity to employment
4. purchase price
5. condition of the local RE market
Our recommendation is to work the numbers. On a a purchase: sale price, taxes, insurance, fees, maintenance, etc. and what you will be able to recover when you sell it. Compare this information with the cost to rent for two years and not have the worry of whether or not you can sell it.
I would rent.
Does it make more economic sense to rent or to buy? Using your numbers find out below.
Why renting at a higher monthly cost than buying could be the best choice. A very different way to look at things below.
The real problem is selling costs. Add in closing costs you pay to buy a house, realtor fees to sell the house and it is easy to see how short term buying does not make any economic sense. I saw one professional say between the 2 you will end up paying about 12% of the purchase price in lost fees.
The exception to buying short term would be if house prices rose dramatically in a short time. This is not anticipated in most areas. I would seriously doubt that buying would make sense for you. Perhaps if you bought a real fixer upper and did tons of work it might pay you or break even. But that is doing work to make money not just buying and reselling.