If you shoot someone in self defence you _will_ need to to have a lawyer. The cost of the firearm will be minimal compared to legal expenses. Add in the cost of cleaning up after the body is removed, (bloode, urine, feces, brains etc will ruin carpet & paintwork),there may be damage to the property in the course of the shooting, damaged possessions needing replacement, if renting add in the cost of moving if the owners decide they don't want you as a tenant anymore, or if there are threats from the goblin if it survives or its family if it doesn't you may need to move even if you own the place.
Seriously, expect to be out a very large sum of money if you are ever involved in a shooting. Don't expect to ever be in a shooting though, they are actually quite rare.
Glock 17s do not run to over a thousand, at least at the moment. With the ongoing devaluation of the US dollar that may change. The Glock 17 is a fine firearm, with a decent set of sights it's quite capable of doing duty as a competition firearm in games such as USPSA/IPSC & IDPA. It's also quite acceptable as a self defence firearm.
Do try before you buy however, find a range that rents guns and shoot them all so you can work out the one that is most suited to you.
FWIW, I've owned some 14 handguns and shot 76 different models in the last ten years. The Glock 17 was my first and remains my standby gun. There are others that are prettier, more accurate, fit my hand better, the G17 just happens to be a great all round handgun.