Model S - Options by Year - Tesla Motors Club Wiki
https://www.teslaadviceblog.com/blog/buying-guide-model-s-versions-1-2-3-and-4
I have no idea of your vehicle ownership history. If you have previously owned 5+ year old Mercedes S class cars, then this is no problem, if your previous cars are Honda Accords and Toyota Camry's read on. Many items on the Model S are expensive to fix, and some are very expensive. You are contemplating spending 30K on a car, there are several repairs that are in the 3K range. If that concerns you then I suggest buying one directly from Tesla to take advantage of their full coverage warranty that they provide with their cars. As you look at a car, check the VIN and realize this is the XX,XXX car Tesla ever produced from scratch. If X is less than 10,000 you are braver than I am.
If you buy one without a bumper to bumper warranty, consider how long it has been since it last had a warranty. If it is a single owner car then it had warranty for 4 years or 50K miles. If the car is 6+ years old you should assume that anything that broke (that didn't literally stop the car working) over the last two + years is still broken. This may not be the case, but getting service history from Tesla is difficult these days in my experience. The average repair cost on these cars is no laughing matter. Tesla isn't unreasonable in their cost to repair, but those costs are in line with a BMW 7 series or a Mercedes S Class, not a Toyota Camry. A car not serviced for two years could be looking at $6000 in deferred repairs. If you are a very good auto inspector you might catch a fraction of that, many of these issues are hard to detect on even the most vigorous test drive. Search the forums here, there is a third party warranty company on here and they can give you a quote for the car you are considering, if you want to buy from someone besides Tesla. That quote will give you an idea of what that company expects to spend fixing that car over that period of time. I am not saying you should buy the warranty, however you should budget that kind of money into your car fund to keep it happy over the time you own it.
These car's (assuming clean title here) have an 8 year unlimited mile warranty on the drive unit and the battery. This doesn't include wheel bearings, drive shafts, hubs, or anything outside of those two specific modules. If you are buying one at or past that warranty, you are again being quite brave. The aftermarket support for these vehicles is presently less than 6 serious shops across the country. That picture will likely change after 2020, but for now, it isn't easy.
I am not trying to scare you off, but I don't want to read your thread in six months about how you can't afford this car due to repair work and you had to sell it at a big loss.
Happy hunting!