Ignition Wiring Issue, please help.

I don't have a full understanding of the ballast resistor? why would it spark when I release the key?