Modern airliners typically use a Terrain Awareness and Warning System (TAWS) with two sources of information for triggering warnings: the radio altimeter and a global terrain database. See e.g. the Boeing 737 NG, which uses EGPWS (Enhanced Ground Proximity Warning System):
Ground Proximity Alerts
The GPWS provides alerts for potentially hazardous flight conditions involving
imminent impact with the ground.
The GPWS monitors terrain proximity using an internal world wide terrain data
base. Proximate terrain data shows on the navigation display. If there is a potential
terrain conflict, alerts are provided based on estimated time to impact. These alerts
are “look-ahead terrain alerts.”
The GPWS provides alerts based on radio altitude and combinations of barometric
altitude, airspeed, glide slope deviation, and airplane configuration. The alerts are
for:
- excessive descent rate
- excessive terrain closure rate
- altitude loss after takeoff or go-around
- unsafe terrain clearance when not in the landing configuration
- excessive deviation below an ILS glide slope
- excessive deviation below glidepath
These alerts are “radio altitude based alerts.”
(Boeing 737 NG FCOM 15.20.11 Warning Systems - System Description, emphasis mine)
For the terrain database to work, the aircraft needs to know its position from a GNSS source (like GPS), but can also use another source (like inertial position) as backup:
5.3 Primary Horizontal Position Sources. Horizontal position for TAWS must come from a GNSS source
meeting ETSO-C129a or any revision of ETSO-C145, ETSO-C146, or ETSO-C196 (or subsequent). As an exception, TAWS equipment limited to installation in aircraft where the EU Regulation on Air Operations
does not require such equipment may be configurable to operate solely on a non-GNSS position source.
5.4 Alternate Horizontal Position Sources. Retaining TAWS functionality during GNSS outage or
unavailability provides a safety benefit. It is acceptable and recommended to incorporate a secondary, non
GNSS position source, to provide horizontal position when the GNSS is not available or reliable.
(ETSO-C151c, thanks to DeltaLima for pointing this out)
So there are two signals that need to work in clouds for full TAWS capabilities.
Radio Altimeter:
For the radio altimeter to work in a cloud, the radar signal needs to be able to penetrate the cloud and reflect off the ground. Only the part of the cloud below the aircraft is relevant here. Airbus published a nice overview of factors that could result in erroneous RA values:
The external causes may be linked
to aircraft flying over:
- Other aircraft, hail clouds or
bright spots, i.e. terrain presenting
reflectivity variations.
- Runways contaminated with water or snow.
In these cases, the RA condition
may not be detected by the systems,
which continue to use the erroneous
RA values.
(Airbus Safety First Magazine - Radio Altimeter erroneous values, emphasis mine)
So normal clouds should not affect the radio altimeter, but clouds with dense precipitation (like hail) can have such an affect. Note however, that if the radio signal reflects off the cloud itself, it could result in a false positive alert, but not a false negative.
GPS signal:
Here, the clouds above the aircraft are relevant, since they could block the signal to the satellite. The GPS signal is however largely unaffected by weather:
Does RAIN or SNOW or CLOUDS affect the reception of my GPS receiver?
Answer: No. Not so as the user can tell without instrumentation.
[...]
The GPS signal frequency of about 1575mhz was chosen expressly because it is a "window" in the weather as far as signal propagation is concerned.
(gpsinformation.net)
Even if the GPS signal is temporarily lost, the Alternate Horizontal Position Source can take over. The inertial position accuracy from the ADIRU would slowly degrade over time, but provide a good position estimate just after the GPS signal is lost.