From the sound of it a hard drive change shouldn't make Windows think it is a different computer so the license should still be good. Even if it did, there is apparently a process in the Activation -> Troubleshooting wizard to inform Microsoft that you changed hardware recently and tell them which computer it is to fix activation. I think you should be good in this case.
Notably, while researching this, I discovered that if you upgraded a retail copy of Windows then you cannot reinstall the old retail copy and upgrade again. You'd have to buy a license for Windows 10 in that case. Alas, I have no real interest in running any Windows so my Windows 7 license can remain on the shelf.
It does sound that it might apply to you since you upgraded Windows 8. You're going to be replacing the hard drive with Windows on it, so presumably you'll have to reinstall from a disc. In that case, you may have to buy a new license to get Windows 10... But I'd do a little research before I succumbed to that. Maybe you could use the "hardware change" wizard thingy mentioned above to get Microsoft to allow the upgrade again?
Worst case, you could always try calling Microsoft support and asking about it.