Manage GCP Identity-Aware Proxy IAM for Cloud Run

The gcp:iap/webCloudRunServiceIamMember:WebCloudRunServiceIamMember resource, part of the Pulumi GCP provider, grants IAM permissions to individual members for IAP-protected Cloud Run services. This guide focuses on three capabilities: adding individual members, time-limited access with IAM Conditions, and bulk member grants via role bindings.

This resource manages access to existing Cloud Run services with IAP enabled. The examples are intentionally small. Combine them with your own Cloud Run services, IAP configuration, and organizational access policies.

Grant a single user access to a Cloud Run service

Most IAP access control starts by granting individual users permission to access protected services without affecting existing members or roles.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.iap.WebCloudRunServiceIamMember("member", {
    project: _default.project,
    location: _default.location,
    cloudRunServiceName: _default.name,
    role: "roles/iap.httpsResourceAccessor",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.iap.WebCloudRunServiceIamMember("member",
    project=default["project"],
    location=default["location"],
    cloud_run_service_name=default["name"],
    role="roles/iap.httpsResourceAccessor",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iap.NewWebCloudRunServiceIamMember(ctx, "member", &iap.WebCloudRunServiceIamMemberArgs{
			Project:             pulumi.Any(_default.Project),
			Location:            pulumi.Any(_default.Location),
			CloudRunServiceName: pulumi.Any(_default.Name),
			Role:                pulumi.String("roles/iap.httpsResourceAccessor"),
			Member:              pulumi.String("user:jane@example.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var member = new Gcp.Iap.WebCloudRunServiceIamMember("member", new()
    {
        Project = @default.Project,
        Location = @default.Location,
        CloudRunServiceName = @default.Name,
        Role = "roles/iap.httpsResourceAccessor",
        Member = "user:jane@example.com",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.iap.WebCloudRunServiceIamMember;
import com.pulumi.gcp.iap.WebCloudRunServiceIamMemberArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var member = new WebCloudRunServiceIamMember("member", WebCloudRunServiceIamMemberArgs.builder()
            .project(default_.project())
            .location(default_.location())
            .cloudRunServiceName(default_.name())
            .role("roles/iap.httpsResourceAccessor")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:iap:WebCloudRunServiceIamMember
    properties:
      project: ${default.project}
      location: ${default.location}
      cloudRunServiceName: ${default.name}
      role: roles/iap.httpsResourceAccessor
      member: user:jane@example.com

The member property identifies who receives access (user, service account, group, or special identifier). The role property specifies what they can do; roles/iap.httpsResourceAccessor allows HTTPS access through IAP. The cloudRunServiceName, project, and location properties identify which Cloud Run service to grant access to. This resource is non-authoritative: it adds the member without removing others who already have the role.

Grant time-limited access with IAM Conditions

Organizations implementing temporary access or compliance requirements can automatically expire permissions at a specific time.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.iap.WebCloudRunServiceIamMember("member", {
    project: _default.project,
    location: _default.location,
    cloudRunServiceName: _default.name,
    role: "roles/iap.httpsResourceAccessor",
    member: "user:jane@example.com",
    condition: {
        title: "expires_after_2019_12_31",
        description: "Expiring at midnight of 2019-12-31",
        expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
    },
});
import pulumi
import pulumi_gcp as gcp

member = gcp.iap.WebCloudRunServiceIamMember("member",
    project=default["project"],
    location=default["location"],
    cloud_run_service_name=default["name"],
    role="roles/iap.httpsResourceAccessor",
    member="user:jane@example.com",
    condition={
        "title": "expires_after_2019_12_31",
        "description": "Expiring at midnight of 2019-12-31",
        "expression": "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
    })
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iap.NewWebCloudRunServiceIamMember(ctx, "member", &iap.WebCloudRunServiceIamMemberArgs{
			Project:             pulumi.Any(_default.Project),
			Location:            pulumi.Any(_default.Location),
			CloudRunServiceName: pulumi.Any(_default.Name),
			Role:                pulumi.String("roles/iap.httpsResourceAccessor"),
			Member:              pulumi.String("user:jane@example.com"),
			Condition: &iap.WebCloudRunServiceIamMemberConditionArgs{
				Title:       pulumi.String("expires_after_2019_12_31"),
				Description: pulumi.String("Expiring at midnight of 2019-12-31"),
				Expression:  pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var member = new Gcp.Iap.WebCloudRunServiceIamMember("member", new()
    {
        Project = @default.Project,
        Location = @default.Location,
        CloudRunServiceName = @default.Name,
        Role = "roles/iap.httpsResourceAccessor",
        Member = "user:jane@example.com",
        Condition = new Gcp.Iap.Inputs.WebCloudRunServiceIamMemberConditionArgs
        {
            Title = "expires_after_2019_12_31",
            Description = "Expiring at midnight of 2019-12-31",
            Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.iap.WebCloudRunServiceIamMember;
import com.pulumi.gcp.iap.WebCloudRunServiceIamMemberArgs;
import com.pulumi.gcp.iap.inputs.WebCloudRunServiceIamMemberConditionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var member = new WebCloudRunServiceIamMember("member", WebCloudRunServiceIamMemberArgs.builder()
            .project(default_.project())
            .location(default_.location())
            .cloudRunServiceName(default_.name())
            .role("roles/iap.httpsResourceAccessor")
            .member("user:jane@example.com")
            .condition(WebCloudRunServiceIamMemberConditionArgs.builder()
                .title("expires_after_2019_12_31")
                .description("Expiring at midnight of 2019-12-31")
                .expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
                .build())
            .build());

    }
}
resources:
  member:
    type: gcp:iap:WebCloudRunServiceIamMember
    properties:
      project: ${default.project}
      location: ${default.location}
      cloudRunServiceName: ${default.name}
      role: roles/iap.httpsResourceAccessor
      member: user:jane@example.com
      condition:
        title: expires_after_2019_12_31
        description: Expiring at midnight of 2019-12-31
        expression: request.time < timestamp("2020-01-01T00:00:00Z")

The condition block adds time-based restrictions to the permission grant. The expression property uses CEL (Common Expression Language) to define when access is valid; here, access expires at midnight on 2020-01-01. The title and description properties document the condition’s purpose. IAM Conditions have known limitations documented in the GCP IAM Conditions overview; review those before using conditions in production.

Grant a role to multiple members at once

When multiple users need the same level of access, binding a role to a list of members is more efficient than creating individual member resources.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const binding = new gcp.iap.WebCloudRunServiceIamBinding("binding", {
    project: _default.project,
    location: _default.location,
    cloudRunServiceName: _default.name,
    role: "roles/iap.httpsResourceAccessor",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.iap.WebCloudRunServiceIamBinding("binding",
    project=default["project"],
    location=default["location"],
    cloud_run_service_name=default["name"],
    role="roles/iap.httpsResourceAccessor",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/iap"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := iap.NewWebCloudRunServiceIamBinding(ctx, "binding", &iap.WebCloudRunServiceIamBindingArgs{
			Project:             pulumi.Any(_default.Project),
			Location:            pulumi.Any(_default.Location),
			CloudRunServiceName: pulumi.Any(_default.Name),
			Role:                pulumi.String("roles/iap.httpsResourceAccessor"),
			Members: pulumi.StringArray{
				pulumi.String("user:jane@example.com"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var binding = new Gcp.Iap.WebCloudRunServiceIamBinding("binding", new()
    {
        Project = @default.Project,
        Location = @default.Location,
        CloudRunServiceName = @default.Name,
        Role = "roles/iap.httpsResourceAccessor",
        Members = new[]
        {
            "user:jane@example.com",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.iap.WebCloudRunServiceIamBinding;
import com.pulumi.gcp.iap.WebCloudRunServiceIamBindingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var binding = new WebCloudRunServiceIamBinding("binding", WebCloudRunServiceIamBindingArgs.builder()
            .project(default_.project())
            .location(default_.location())
            .cloudRunServiceName(default_.name())
            .role("roles/iap.httpsResourceAccessor")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:iap:WebCloudRunServiceIamBinding
    properties:
      project: ${default.project}
      location: ${default.location}
      cloudRunServiceName: ${default.name}
      role: roles/iap.httpsResourceAccessor
      members:
        - user:jane@example.com

The WebCloudRunServiceIamBinding resource grants a role to multiple members in a single operation. The members property accepts a list of identities. This resource is authoritative for the specified role: it replaces all members for that role. You can combine Binding resources with Member resources as long as they don’t grant the same role (otherwise they conflict).

Beyond these examples

These snippets focus on specific IAM member features: individual and bulk member grants, time-based access with IAM Conditions, and role binding vs member assignment. They’re intentionally minimal rather than full access control configurations.

The examples assume pre-existing infrastructure such as Cloud Run services with IAP enabled and a GCP project with appropriate permissions. They focus on granting access rather than provisioning the underlying services.

To keep things focused, common IAM patterns are omitted, including:

  • Full policy replacement (WebCloudRunServiceIamPolicy)
  • Combining Policy with Binding/Member resources (causes conflicts)
  • Custom role definitions and formatting
  • Service account and federated identity configuration

These omissions are intentional: the goal is to illustrate how each IAM member feature is wired, not provide drop-in access control modules. See the WebCloudRunServiceIamMember resource reference for all available configuration options.

Let's manage GCP Identity-Aware Proxy IAM for Cloud Run

Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.

Try Pulumi Cloud for FREE

Frequently Asked Questions

Resource Selection & Conflicts
What's the difference between WebCloudRunServiceIamPolicy, IamBinding, and IamMember?
WebCloudRunServiceIamPolicy is authoritative and replaces the entire IAM policy. WebCloudRunServiceIamBinding is authoritative for a specific role, replacing all members for that role while preserving other roles. WebCloudRunServiceIamMember is non-authoritative, adding a single member to a role without affecting other members.
What are the restrictions when using multiple IAM resources together?
WebCloudRunServiceIamPolicy cannot be used with WebCloudRunServiceIamBinding or WebCloudRunServiceIamMember, as they will conflict over policy state. WebCloudRunServiceIamBinding and WebCloudRunServiceIamMember can be used together only if they grant different roles.
Which IAM resource should I use to add a single user without affecting existing permissions?
Use WebCloudRunServiceIamMember for non-authoritative grants that preserve existing members and roles.
Identity & Role Configuration
How do I grant access to a specific user?
Set role to the desired role (e.g., roles/iap.httpsResourceAccessor) and member to user:{emailid} (e.g., user:jane@example.com).
What identity formats are supported for the member parameter?
Supported formats include allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, and federated identities using the principal:// format.
What's the correct format for custom IAM roles?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name} (e.g., projects/my-project/roles/customRole).
IAM Conditions
How do I add time-based or conditional access restrictions?
Use the condition property with title, description, and expression fields. For example, set expression to request.time < timestamp("2020-01-01T00:00:00Z") for time-based expiration.
What should I know about IAM Conditions limitations?
IAM Conditions have known limitations that may affect your use case. Review the GCP documentation on IAM Conditions limitations if you encounter issues.
Resource Properties & Immutability
What properties can't be changed after creation?
All key properties are immutable: cloudRunServiceName, location, project, role, member, and condition. Changes require resource replacement.
How do I import existing IAM bindings?
Use the format projects/{{project}}/iap_web/cloud_run-{{location}}/services/{{name}} roles/iap.httpsResourceAccessor user:jane@example.com for member imports, or omit the member for binding imports.

Using a different cloud?

Explore security guides for other cloud providers: