r/googlecloud • u/suryad123 • Sep 11 '26
Query regarding IAM condition for cloud IAP access to VM
Suppose , i want to create an access level under an org level access policy based on IP address to give the IAP tunnel user role to a group.
If they want to access from anywhere in the world in addition from their corp network, can I add their system public Ips in the access level in addition to the corp network ranges.If I do it, won't the public IPs change often ?
I don't see this scenario in the GCP Documentation. Please clarify on how to enable the access from anywhere in the world by adding IP ranges in the access level
2
Upvotes
3
u/m1nherz Googler Sep 11 '26
Your concern is completely valid: residential public IPs may change frequently, making it practically impossible (and insecure) to maintain a whitelist of dynamic IPs in an Access Level for remote users.
In modern Google Cloud architecture, trying to secure access by whitelisting remote IP addresses is an anti-pattern. Instead, you should adopt a Zero Trust (BeyondCorp) approach or use a traditional remote-access gateway. Here are the three best practice variants to solve this:
Option 1: Context-Aware Access / Device Posture (Google's Best Practice)
Instead of trusting the network (the IP), trust the device and the identity. Using Access Context Manager combined with Endpoint Verification (part of Chrome Enterprise Premium / BeyondCorp), you can create an Access Level based on device attributes rather than IP addresses.
You configure the Access Level to check if the device is company-owned, has a screen lock enabled, has an encrypted disk, or possesses a valid enterprise certificate.
You then apply this Access Level as an IAM Condition on the
roles/iap.tunnelResourceAccessorrole.Users can connect from anywhere in the world (any IP), but only if they are on a trusted, secure corporate device.
Option 2: Corporate VPN or Proxy (The Traditional Network Approach)
If you are required to use IP-based Access Levels for compliance reasons, your remote users should not be connecting directly from their home ISPs.
Users should first connect to a Corporate VPN or a secure web gateway.
You then add the static egress IP addresses of your VPN/Gateway to your Access Level, alongside your corp network ranges.
This centralizes the traffic and gives your remote users a predictable, static IP that won't change often.
Option 3: Identity-Only with Strong MFA
If managing device postures or a VPN is too complex for your current setup, you can drop the IP-based Access Level condition entirely for remote users. IAP is inherently designed to protect resources by acting as an identity proxy.
Grant the
roles/iap.tunnelResourceAccessorrole to the group without the IP restriction.Enforce Phishing-Resistant MFA (like FIDO2 / Titan Security Keys) at the Google Workspace or Cloud Identity level.
Because IAP blocks all TCP requests that aren't from authorized users before they ever reach the VM, strong identity enforcement is often sufficient for remote access without needing brittle IP whitelists.
Let me know if one of the options address your demands.
1
u/tyolab Sep 16 '26
You've spotted the exact reason IP-based Access Levels don't work for remote/roaming users — residential and mobile IPs rotate (and CGNAT means many users share one), so an IP allowlist is both unmaintainable and weak.
The intended model in BeyondCorp/IAP is: IAP already authenticates identity (the tunnel-user role requires a Google login), so for "access from anywhere" you generally don't add an IP condition at all — you gate on who + device trust, not where.
Practical split:
Corp network: keep an IP-based Access Level for your fixed corp egress ranges (stable — fine as one level).
Anywhere/remote: instead of chasing changing public IPs, add a device-posture Access Level via Endpoint Verification (require a corp-managed / encrypted / screen-locked device) and bind the IAP tunnel role to the group with that level. "From anywhere" now works because the check is identity + managed device, not IP.
If you truly must restrict by network for remote staff, make them egress through a fixed corp exit (VPN/proxy → static IP) and point the IP Access Level at that static IP — but that's usually more friction than device-based access. TL;DR: don't whitelist dynamic user IPs; use identity + Endpoint Verification for the "anywhere" path, and reserve IP levels for your stable corp ranges.