How to turn on module like ESP8266 only when switch is activated?
Dampmaskin has the right idea, but his design is overly simplistic, for the reasons I outlined in my comments.

A more robust circuit would look like this:







simulate this circuit &ndash; Schematic created using CircuitLab

R1 and R3 make sure that leakage currents in either transistor won't cause unwanted activation of the circuit.

Obviously, the micro must set the GPIO pin high as soon as possible after it comes out of reset, before C1 discharges too far (make C1 larger if necessary). Then, it can set the pin low (or tristate it) when the task it is doing is complete.

You can substitute MOSFETs for the BJTs if you like, in which case, R2 and R4 are not needed (but they cause no harm, either).