Assuming that the rifle purchased was not capable of fully automatic fire and had a barrel length meeting the minimum requirement, as long as the rifle remained in your possession you are OK. Giving it away (to a relative) or swapping it (at a gun show) is not clearly defined. If you were to sell your rifle in your new state of residency it could be considered a 'straw man purchase' unless you happened to be a licensed firearms dealer.
Regards,
GtG
Not to beat a dead horse, but residency doesn’t change wrt active duty military - domicile does. I had several domiciles across the country over the years and could legally purchase handguns, rifles or shotguns with a copy of my orders. My only residence remained the state I entered active duty from because I made no effort to change it. One of the benefits of the Soldiers and Sailors Civil Relief Act.