Yeah usually I just go with putting oats down in a big bucket, and then cotton on top for the adults to breed in. Gives a pretty simple feeder for my ants, with limited casualties, but needs pretty frequent cleaning for the shedskin and beetle corpses. The problem with a terrarium, as you mentioned, is in part because of the moisture. It would also be problematic because depending on your setup the hatched mealworms will have to migrate back to the food source. Somehow, if you wanted this to work, you'd have to put both in one set-up.
What you could do, which would look pretty weird, admittedly, would be to have an old fish tank or glass container, and place some rocks and decor in it, with large basins of bran (perhaps with cotton on it) disguised by the fake plants in front and around it. That way, you can still watch your beetles wandering around in the terrarium, but mealworms will still be able to hatch and eat without limits.
Overall, however, I agree with AntDrew's more succinct answer, that isopods would be a much better option. Beetles are great as feeder insects, but they really aren't very entertaining, and in my experience, adult beetles are kind of clumsy and any foraging behaviour will basically not be noticeable in a terrarium set-up, while mealworms...well, they basically just eat and sleep 24/7. Isopods would be a better option, because A. They can live and thrive in a terrarium set-up, they look really cool, and paired with other organisms they will really help boost your terrarium's growth, removing fungal outbreaks and breaking down fallen leaves and branches into useable soil.
Manica invidia (1 queen, ~200 workers)
Manica invidia (1 colonies, 1 queens plus 3 workers)
Lasius niger (single queen, ~200 workers - naturalistic, predatory set-up)
Lasius americanus (1 colony, ~10 workers)
Tetramorium immigrans (3 colonies, 3 queens, ~ five workers each | 1 colony, 1 queen, ~1200 workers)
Formica aserva (aserva queen, ~15 ​Formica neorufibarbis workers)
"And God made...everything that creeps on the ground according to its kind.
And God saw that it was good." - Genesis 1:25