If it is supplied from the voltage source That resistor will limit your current to 14mA as the LEDs are all in series.
Vsupply = Vleds + Vr.
Vled = 7*3
Vr = Vsupply - Vleds
CurrentLED = CurrentR = Vr/R = 27/2k = 0.0135mA
Changing the value of that 2K resistor would change the brightness of your LEDs though going too low will “let the smoke out”.Sorry if I went too maths. but Robin is right the 40V is fine as long as the current is limited.