Manage GCP Project IAM Members

The gcp:projects/iAMMember:IAMMember resource, part of the Pulumi GCP provider, grants a single member access to a GCP project role without affecting other members assigned to that role. This resource is non-authoritative, meaning it adds one member to a role while preserving existing assignments. This guide focuses on two capabilities: single-member role assignment and time-based access with IAM Conditions.

IAMMember requires an existing GCP project and valid member identities. The examples are intentionally small. Combine them with your own project configuration and identity management.

Grant a role to a single member

Most IAM configurations start by granting a specific role to one user or service account without disrupting existing access.

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

const project = new gcp.projects.IAMMember("project", {
    project: "your-project-id",
    role: "roles/editor",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

project = gcp.projects.IAMMember("project",
    project="your-project-id",
    role="roles/editor",
    member="user:jane@example.com")
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := projects.NewIAMMember(ctx, "project", &projects.IAMMemberArgs{
			Project: pulumi.String("your-project-id"),
			Role:    pulumi.String("roles/editor"),
			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 project = new Gcp.Projects.IAMMember("project", new()
    {
        Project = "your-project-id",
        Role = "roles/editor",
        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.projects.IAMMember;
import com.pulumi.gcp.projects.IAMMemberArgs;
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 project = new IAMMember("project", IAMMemberArgs.builder()
            .project("your-project-id")
            .role("roles/editor")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  project:
    type: gcp:projects:IAMMember
    properties:
      project: your-project-id
      role: roles/editor
      member: user:jane@example.com

The member property specifies who receives access using formats like user:jane@example.com for Google accounts or serviceAccount:app@project.iam.gserviceaccount.com for service accounts. The role property defines the permission set, using predefined roles like roles/editor or custom roles in the format projects/{project-id}/roles/{role-name}. Because IAMMember is non-authoritative, it adds this member to the role without removing others.

Add time-limited access with IAM Conditions

Temporary access grants expire automatically when you attach time bounds through IAM Conditions.

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

const project = new gcp.projects.IAMMember("project", {
    project: "your-project-id",
    role: "roles/firebase.admin",
    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

project = gcp.projects.IAMMember("project",
    project="your-project-id",
    role="roles/firebase.admin",
    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/projects"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := projects.NewIAMMember(ctx, "project", &projects.IAMMemberArgs{
			Project: pulumi.String("your-project-id"),
			Role:    pulumi.String("roles/firebase.admin"),
			Member:  pulumi.String("user:jane@example.com"),
			Condition: &projects.IAMMemberConditionArgs{
				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 project = new Gcp.Projects.IAMMember("project", new()
    {
        Project = "your-project-id",
        Role = "roles/firebase.admin",
        Member = "user:jane@example.com",
        Condition = new Gcp.Projects.Inputs.IAMMemberConditionArgs
        {
            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.projects.IAMMember;
import com.pulumi.gcp.projects.IAMMemberArgs;
import com.pulumi.gcp.projects.inputs.IAMMemberConditionArgs;
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 project = new IAMMember("project", IAMMemberArgs.builder()
            .project("your-project-id")
            .role("roles/firebase.admin")
            .member("user:jane@example.com")
            .condition(IAMMemberConditionArgs.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:
  project:
    type: gcp:projects:IAMMember
    properties:
      project: your-project-id
      role: roles/firebase.admin
      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 constraints to the role assignment. The expression property uses Common Expression Language (CEL) to define when access is valid; here, request.time < timestamp("2020-01-01T00:00:00Z") grants access until midnight on December 31, 2019. The title and description properties document the condition’s purpose. IAM Conditions cannot be used with Basic Roles like Owner; they work only with predefined or custom roles.

Beyond these examples

These snippets focus on specific IAMMember features: single-member role assignment and time-based IAM Conditions. They’re intentionally minimal rather than complete access control configurations.

The examples require pre-existing infrastructure such as a GCP project with project ID and user accounts or service accounts to grant access to. They focus on configuring individual member assignments rather than managing complete IAM policies.

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

  • Multi-member role assignment (use IAMBinding instead)
  • Complete policy replacement (use IAMPolicy instead)
  • Audit logging configuration (use IAMAuditConfig instead)
  • Resource-level conditions beyond time constraints

These omissions are intentional: the goal is to illustrate how IAMMember grants work, not provide drop-in access control modules. See the IAMMember resource reference for all available configuration options.

Let's manage GCP Project IAM Members

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 & Compatibility
Which IAM resource should I use for my project?
Choose based on your needs: gcp.projects.IAMPolicy replaces the entire policy (authoritative), gcp.projects.IAMBinding manages all members for a specific role (authoritative per role), and gcp.projects.IAMMember adds individual members to a role (non-authoritative). Use IAMPolicy for full control, IAMBinding for role-level management, or IAMMember for granular member additions.
Can I use IAMPolicy with IAMBinding or IAMMember?
No, gcp.projects.IAMPolicy cannot be used with gcp.projects.IAMBinding, gcp.projects.IAMMember, or gcp.projects.IAMAuditConfig because they will conflict over policy state. Choose one approach and stick with it.
Can I use IAMBinding and IAMMember together?
Yes, but only if they don’t grant privileges to the same role. Using both for the same role causes resource conflicts.
Safety & Access Control
What happens if I delete an IAMPolicy resource?
Deleting gcp.projects.IAMPolicy removes access from anyone without organization-level access, potentially locking you out of your project. It’s not recommended for your provider project. Always import the existing policy before applying changes to avoid accidental lockouts.
Configuration & Identity Formats
What identity formats can I use for members?

Four formats are supported:

  1. user:{emailid} - Specific Google account (e.g., user:alice@gmail.com)
  2. serviceAccount:{emailid} - Service account (e.g., serviceAccount:my-app@appspot.gserviceaccount.com)
  3. group:{emailid} - Google group (e.g., group:admins@example.com)
  4. domain:{domain} - All users in a G Suite domain (e.g., domain:example.com)
What's the difference between 'member' and 'members' properties?
gcp.projects.IAMBinding uses members (plural) to specify a list of identities, while gcp.projects.IAMMember uses member (singular) to specify a single identity.
How do I specify custom roles?
Custom roles must follow the format [projects|organizations]/{parent-name}/roles/{role-name}, for example: projects/my-project/roles/customRole or organizations/my-org/roles/customRole.
Limitations & Constraints
Why am I getting a 400 error when using IAM Conditions?
IAM Conditions cannot be used with Basic Roles such as Owner. This violates API constraints and returns a 400 error. Use IAM Conditions only with predefined or custom roles.
Can I use only one IAMBinding per role?
Yes, only one gcp.projects.IAMBinding can be used per role. If you need to manage multiple members for the same role, include them all in the members list of a single IAMBinding, or use multiple gcp.projects.IAMMember resources instead.
Immutability & Lifecycle
What properties can't be changed after creation?
All core properties are immutable: member, project, role, and condition. Changing any of these requires recreating the resource.

Using a different cloud?

Explore security guides for other cloud providers: