I did something like that for the named Demon Lords in Out of the Abyss: they're immune to 2nd level and lower spells unless they want to be affected, immune to nonmagical attacks, and anything less than +3 weapons or another demon lord-type attack, they're resistant.
It may sound harsh, but they're supposed to be badass eons old demigods that have survived the Blood War and intervention by gods. When a group of PCs run along after roughly 6 months of on-the-job training and confronts one, it seems silly they'd take them out in a typical 3 round D&D combat.
In short, I'm a big fan of using certain AD&D-style monsters more like puzzles to be solved than a big bag of hit points to be whittled down. It gives individual classes a chance to shine and can lead to innovation, such as the magic-immune iron golem being tricked into stepping onto an illusory bridge, or clever use of a Dig spell (created a big pit) against a 90% magic resistant creature. Sometimes you had to outthink rather than outpummel, and you had to take special care to collect a variety of weaponry to overcome resistances.
Side note: I ran the finale of Out of the Abyss by giving each PC a demon lord to control, then let them fight it out. The PCs then took on the survivor, a weakened demon lord but a very serious threat nonetheless. There was no warlock character at the time, but in future campaigns, I'm using the A5E version where eldritch blast is a class feature, not a cantrip, solving any future issue if we run into Demon Lords.