Programmable resistor
[ I'm going to ignore the case of connecting 3.3V across 0 Ω.  I'm going to assume that there will always be sufficient resistance to prevent components from getting burned. ]

Probably, the easiest way to do this is to use a digital potentiometer.  If we look at what kinds of digital pots are available, there ones 1 MΩ resistance and 128 taps.