Is there a programmable variable resistor
The term you are looking for is digital potentiometer.
Search for parts to find one that fits your needs. You can get them with up to 10 Bits of resolution. Be aware that on power-up the value might be at min or max until you send the needed value via the digital interface.