Many of the sellers of those solenoids include the necessary resistor and diode but you can buy them separate and ready to install from a number of places.. Here is one
https://www.amazon.com/Universal-Hea...ps%2C99&sr=8-3
and here is an example of the resistor if you dont already have one.
https://www.amazon.com/World-9-99-Ma...dDbGljaz10cnVl
here an example of how they should be installed remember the white line on the diode always goes towards the red or yellow striped solenoid coil screw. (a1 screw in the pic below)