Check the ignition keyswitch. I ran into a similar problem. Sometimes the light would work properly, other times not. It usually started out alright, then faded while riding. Moving the key, even a few degrees, would sometimes restore brightness. Turned out to be oxidized contacts inside the switch. Cleaning the contacts solved the problem...temporarily. Eventually, a second cleaning and applying dialectric grease solved the problem. However, disassembling the switch and getting everything reassembled correctly was a total pain in the ass. Those minuscule pieces have a tendency toward "spontaneous acrobatics" and can be installed in multiple configurations. There's no exploded drawings, for reference, or repair procedures even outlined in any repair manual, making this a 3-D puzzle with a pass/fail test at the end. FWIW, I'd never do this again as long as new OEM, NOS, or good working examples could be sourced. Fortunately, this doesn't seem to be very common problem, so any keyswitch unit is more likely, than not, to function normally.
A weak ground point, or oxidized connection, is the most likely cause. That said, moving the key through it's range of positions is the definitive test for the switch unit itself, and the easiest test of all.