P0010 on GMC Terrain, connector broke while removing

2011 Terrain around100k miles. CEL showed P0010. Looking to change the camshaft solenoids, as most of the online fixes shows these fails regularly. Today tried to take them out for inspection. When tried to remove the connector on top of the solenoid, it came off broken. I did press the top, not sure how it snapped. I put back as it is. The car starts. Is it okay to drive as it is, at least while getting it fixed? I will need to replace the connector. Any idea if this can be done at home? Any special tools needed? what is the part number? The one that broke has blue sitting inside. The other (purple) is fine.

You can buy the pigtail connector at auto store and sometimes the dealer. Cut the old connector off, use crimp connectors or solder the wires to the new connector. I like heat shrink tubing to seal.

Seems like the lock tab is what you broke. It is ok to drive it like that but it might fall off with vibration. Just plug it back in.

Thanks for the feedback. I think it is actually the connector for Variable Valve Timing (VVT) Solenoid / Actuator. Any idea what part number it should be? I tried searching online, could not find on RockAuto. ( https://www.rockauto.com/en/catalog/gmc,2011,terrain,2.4l+l4,1446744,engine,variable+valve+timing+(vvt)+solenoid+/+actuator,12910 ). Not sure if any local shop carries it, does not show on their websites either.
The lock tab broke as well as the inside plastic covering around the terminals came off. The ordered solenoids are coming today. I was wondering if I should try replacing the solenoids with this broken connector, or take it to the auto shop in the morning, since not sure if it will start back up!

Received the VVT solenoids today and went ahead and replaced them. The connector came out as one piece but the locking mechanism is missing (broke off). Attached is the image. will this stay in place without it? What can we do to keep it in place? There is a plastic appearance cover that goes over the engine, will adding an extra piece of foam under help (there is already foam glued to the cover)?
I searched for this part online and looks similar to PT2796 on Autozone website. Both Autozone and Amazon says it fits my vehicle, but ORielly’s says it does not. Rockauto too does not show it under 2011 Terrain fit. Any idea how to make sure the fit?

Use a tie wrap to hold it in place. Foam tends to melt or burn if it wanders in an engine compartment. Or tape around it with electrical tape.

The only way to confirm if the part fits is to buy one and plug it in. Buy the Autozone one so you can easily bring it back if it doesn’t fit.

Thanks for quick reply. I was also thinking of electrical tape but thought will it stay in place when it is hot in there. Not sure how to use the tie wrap! The Auto zone one comes with two white wires, does it matter how these are attached, as the original ones are different colors?