GCP Associate Cloud Engineer Practice Question 28: IAM Condition Expiry

Google Cloud Associate Cloud Engineer · Test 3 · question 8 of 10

IAM & Least Privilegemedium

A contractor needs the Compute Instance Admin (v1) role on a project until December 1, 2026. Access must end automatically on that date, without anyone remembering to remove it, and no other permissions should be granted.

What should you do?

Select one answer
Show answer and explanation

Answer:

  • B. Grant the role with an IAM condition on request.time that is earlier than the expiry timestamp

IAM Conditions add conditional logic to a role binding. A condition such as request.time < timestamp("2026-12-01T00:00:00Z") makes the binding valid only until that time, after which the contractor loses the access automatically, while the binding still grants only the requested role.

Option A relies on a manual process, which is the failure mode the requirement rules out. Option C is not a real capability; organization policies restrict configurations, they do not schedule the removal of bindings. Option D is not possible, because a custom role is a list of permissions and has no expiration attribute (expiry belongs to the binding).

Reference: IAM Conditions overview

Practice Test 3 ›

Study guides for Google Cloud Associate Cloud Engineer