(Update: Cottonwood posted a good reply while I was typing this, but I will leave mine as-is with the additional information.)
Interesting question. The EVSEs that are sold with a plug have a 12" cable due to code requirements.
A NEMA 14-50 cable will work but Tesla doesn't make it easy with the hole that must be cut out of either the side or back of the HPWC. Be sure to set the dip switches to limit the amperage to 40 amps maximum. Since there are two versions of HPWC, follow the correct instructions for your HPWC.
https://www.teslamotors.com/sites/default/files/blog_attachments/ms_hpwc_installation_guide.pdf
https://my.teslamotors.com/sites/de...wall_connector_install_guide_northamerica.pdf
Looking at both installation guides, the "50A Breaker" and "40A Supplied" dip switch settings appear to be the same.
The green ground wire would be used for the mandatory ground connection. The white neutral wire is NOT used as shown in the 220/240 Single Phase illustration.
Ideally, it would be excellent to have a qualified electrician to do the work or double check what you are planning or have done. The electrical codes exist to protect us from harm and property from fire. Work safely and follow all the suggested installation instructions for maximum satisfaction.
If you are looking for a reasonably priced NEMA 14-50 cable, here is one that has 6 gauge wires for the 240 volt connection and 8 gauge for ground and neutral. The length is 4' and the attached connectors are for a range, so they would be removed for HPWC installation and to shorten the cable for code requirements. Again, getting advice from an electrician and reading Tesla's warnings (shown below) is highly recommended.
Range Cord, 4 8/2, Ring, SRDT, Black, UL Listed, NUCORD 94520
"WARNINGS: The Wall Connector must be grounded through a permanent wiring system or an equipment grounding conductor. Do not install or use the Wall Connector near flammable, explosive, harsh, or combustible materials, chemicals, or vapors.
Turn off input power at the circuit breaker before installing or cleaning the Wall Connector.
Use the Wall Connector only within the specified operating parameters.
The Wall Connector is designed only for charging a Tesla vehicle (excluding Tesla Roadster). Do not use it for any other purpose or with any other vehicle or object.
Stop using and do not use the Wall Connector if it is defective, appears cracked, frayed, broken, or otherwise damaged, or fails to operate.
Do not attempt to open, disassemble, repair, tamper with, or modify the Wall Connector. The Wall Connector is not user serviceable. Contact Tesla for any repairs.
Do not use the Wall Connector when you, the vehicle, or the Wall Connector is exposed to severe rain, snow, electrical storm, or other inclement weather.
When transporting the Wall Connector, handle with care. Do not subject it to strong force or impact or pull, twist, tangle, drag, or step on the Wall Connector, to prevent damage to it or any components.
Protect the Wall Connector from moisture, water, liquid, and foreign objects at all times. If any exist or appear to have entered, damaged, or corroded the Wall Connector, do not use the Wall Connector.
Do not touch the Wall Connector’s end terminals with sharp metallic objects, such as wire, tools, or needles. Do not forcefully fold any part of the Wall Connector or damage it with sharp objects.
Do not insert foreign objects into any part of the Wall Connector.
Do not use the Wall Connector when a vehicle cover is on the vehicle.
Use of the Wall Connector may affect or impair the operation of any medical or implantable electronic devices, such as an implantable cardiac pacemaker or an implantable cardioverter defibrillator. Check with the electronic device manufacturer concerning the effects that charging may have on such electronic devices before using the Wall Connector.
CAUTIONS:
Incorrect installation and testing of the Wall Connector could potentially damage either the vehicle’s Battery and/or the Wall Connector itself. Any resulting damage is excluded from the warranty for both the vehicle and the Wall Connector.
Do not operate the Wall Connector in temperatures outside its operating range of -22°F to 113°F (-30°C to +45°C).
Ensure that the charge station’s supply cable is positioned so it will not be stepped on, tripped over, or subjected to damage or stress.
Do not use cleaning solvents to clean any of the Wall Connector’s components. The outside of the Wall Connector, the charging cable, and the connector end of the charging cable should be periodically wiped with a clean dry cloth to remove accumulation of dirt and dust.
Be careful not to damage the circuit board when removing the power entry knock-out."