The legality of the installation depends on the type of equipment in question. If the water heater is electric, no permit is required.