Manage GCP Colab Runtime Template IAM Members

The gcp:colab/runtimeTemplateIamMember:RuntimeTemplateIamMember resource, part of the Pulumi GCP provider, manages IAM permissions for Colab Enterprise RuntimeTemplate resources by granting roles to individual members. This guide focuses on three capabilities: single-member role grants, multi-member role bindings, and full policy replacement.

IAM resources reference existing RuntimeTemplate resources and require appropriate GCP project permissions. The examples are intentionally small. Combine them with your own RuntimeTemplate resources and organizational IAM policies.

Grant a role to a single user

Most IAM configurations start by granting a specific role to one user or service account, preserving existing role assignments while adding new members incrementally.

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

const member = new gcp.colab.RuntimeTemplateIamMember("member", {
    project: runtime_template.project,
    location: runtime_template.location,
    runtimeTemplate: runtime_template.name,
    role: "roles/viewer",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.colab.RuntimeTemplateIamMember("member",
    project=runtime_template["project"],
    location=runtime_template["location"],
    runtime_template=runtime_template["name"],
    role="roles/viewer",
    member="user:jane@example.com")
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := colab.NewRuntimeTemplateIamMember(ctx, "member", &colab.RuntimeTemplateIamMemberArgs{
			Project:         pulumi.Any(runtime_template.Project),
			Location:        pulumi.Any(runtime_template.Location),
			RuntimeTemplate: pulumi.Any(runtime_template.Name),
			Role:            pulumi.String("roles/viewer"),
			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.Colab.RuntimeTemplateIamMember("member", new()
    {
        Project = runtime_template.Project,
        Location = runtime_template.Location,
        RuntimeTemplate = runtime_template.Name,
        Role = "roles/viewer",
        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.colab.RuntimeTemplateIamMember;
import com.pulumi.gcp.colab.RuntimeTemplateIamMemberArgs;
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 RuntimeTemplateIamMember("member", RuntimeTemplateIamMemberArgs.builder()
            .project(runtime_template.project())
            .location(runtime_template.location())
            .runtimeTemplate(runtime_template.name())
            .role("roles/viewer")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:colab:RuntimeTemplateIamMember
    properties:
      project: ${["runtime-template"].project}
      location: ${["runtime-template"].location}
      runtimeTemplate: ${["runtime-template"].name}
      role: roles/viewer
      member: user:jane@example.com

The member property specifies the identity receiving 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 level. This resource is non-authoritative, meaning it adds the member without affecting other members who already have the same role.

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 ensures consistent permissions across a team.

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

const binding = new gcp.colab.RuntimeTemplateIamBinding("binding", {
    project: runtime_template.project,
    location: runtime_template.location,
    runtimeTemplate: runtime_template.name,
    role: "roles/viewer",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.colab.RuntimeTemplateIamBinding("binding",
    project=runtime_template["project"],
    location=runtime_template["location"],
    runtime_template=runtime_template["name"],
    role="roles/viewer",
    members=["user:jane@example.com"])
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := colab.NewRuntimeTemplateIamBinding(ctx, "binding", &colab.RuntimeTemplateIamBindingArgs{
			Project:         pulumi.Any(runtime_template.Project),
			Location:        pulumi.Any(runtime_template.Location),
			RuntimeTemplate: pulumi.Any(runtime_template.Name),
			Role:            pulumi.String("roles/viewer"),
			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.Colab.RuntimeTemplateIamBinding("binding", new()
    {
        Project = runtime_template.Project,
        Location = runtime_template.Location,
        RuntimeTemplate = runtime_template.Name,
        Role = "roles/viewer",
        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.colab.RuntimeTemplateIamBinding;
import com.pulumi.gcp.colab.RuntimeTemplateIamBindingArgs;
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 RuntimeTemplateIamBinding("binding", RuntimeTemplateIamBindingArgs.builder()
            .project(runtime_template.project())
            .location(runtime_template.location())
            .runtimeTemplate(runtime_template.name())
            .role("roles/viewer")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:colab:RuntimeTemplateIamBinding
    properties:
      project: ${["runtime-template"].project}
      location: ${["runtime-template"].location}
      runtimeTemplate: ${["runtime-template"].name}
      role: roles/viewer
      members:
        - user:jane@example.com

The RuntimeTemplateIamBinding resource grants a role to multiple members simultaneously through the members array. This resource is authoritative for the specified role, replacing any existing member list for that role while preserving other roles on the RuntimeTemplate. Use this when you want to define the complete set of members for a specific role.

Replace the entire IAM policy

Organizations with strict access control requirements sometimes need to define the complete IAM policy from scratch, replacing any existing permissions.

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

const admin = gcp.organizations.getIAMPolicy({
    bindings: [{
        role: "roles/viewer",
        members: ["user:jane@example.com"],
    }],
});
const policy = new gcp.colab.RuntimeTemplateIamPolicy("policy", {
    project: runtime_template.project,
    location: runtime_template.location,
    runtimeTemplate: runtime_template.name,
    policyData: admin.then(admin => admin.policyData),
});
import pulumi
import pulumi_gcp as gcp

admin = gcp.organizations.get_iam_policy(bindings=[{
    "role": "roles/viewer",
    "members": ["user:jane@example.com"],
}])
policy = gcp.colab.RuntimeTemplateIamPolicy("policy",
    project=runtime_template["project"],
    location=runtime_template["location"],
    runtime_template=runtime_template["name"],
    policy_data=admin.policy_data)
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
			Bindings: []organizations.GetIAMPolicyBinding{
				{
					Role: "roles/viewer",
					Members: []string{
						"user:jane@example.com",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = colab.NewRuntimeTemplateIamPolicy(ctx, "policy", &colab.RuntimeTemplateIamPolicyArgs{
			Project:         pulumi.Any(runtime_template.Project),
			Location:        pulumi.Any(runtime_template.Location),
			RuntimeTemplate: pulumi.Any(runtime_template.Name),
			PolicyData:      pulumi.String(admin.PolicyData),
		})
		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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
    {
        Bindings = new[]
        {
            new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
            {
                Role = "roles/viewer",
                Members = new[]
                {
                    "user:jane@example.com",
                },
            },
        },
    });

    var policy = new Gcp.Colab.RuntimeTemplateIamPolicy("policy", new()
    {
        Project = runtime_template.Project,
        Location = runtime_template.Location,
        RuntimeTemplate = runtime_template.Name,
        PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
import com.pulumi.gcp.colab.RuntimeTemplateIamPolicy;
import com.pulumi.gcp.colab.RuntimeTemplateIamPolicyArgs;
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) {
        final var admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder()
            .bindings(GetIAMPolicyBindingArgs.builder()
                .role("roles/viewer")
                .members("user:jane@example.com")
                .build())
            .build());

        var policy = new RuntimeTemplateIamPolicy("policy", RuntimeTemplateIamPolicyArgs.builder()
            .project(runtime_template.project())
            .location(runtime_template.location())
            .runtimeTemplate(runtime_template.name())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:colab:RuntimeTemplateIamPolicy
    properties:
      project: ${["runtime-template"].project}
      location: ${["runtime-template"].location}
      runtimeTemplate: ${["runtime-template"].name}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

The RuntimeTemplateIamPolicy resource sets the entire IAM policy by consuming policyData from the getIAMPolicy data source. This resource is fully authoritative, replacing all existing role bindings on the RuntimeTemplate. The policyData structure defines bindings that map roles to member lists. This approach cannot be used alongside RuntimeTemplateIamBinding or RuntimeTemplateIamMember resources, as they would conflict over policy ownership.

Beyond these examples

These snippets focus on specific IAM management features: single-member and multi-member role grants, and full policy replacement. They’re intentionally minimal rather than complete access control configurations.

The examples reference pre-existing infrastructure such as Colab Enterprise RuntimeTemplate resources and a GCP project with appropriate IAM permissions. They focus on configuring IAM bindings rather than provisioning the underlying RuntimeTemplate resources.

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

  • Conditional IAM bindings (condition property)
  • Custom role definitions and formatting
  • Federated identity configuration
  • Policy conflict resolution between resource types

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

Let's manage GCP Colab Runtime Template 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 Conflicts & Compatibility
What's the difference between RuntimeTemplateIamPolicy, RuntimeTemplateIamBinding, and RuntimeTemplateIamMember?
RuntimeTemplateIamPolicy is authoritative and replaces the entire IAM policy. RuntimeTemplateIamBinding is authoritative for a specific role, managing all members for that role while preserving other roles. RuntimeTemplateIamMember is non-authoritative, adding individual members to a role without affecting other members.
Why can't I use RuntimeTemplateIamPolicy with RuntimeTemplateIamBinding or RuntimeTemplateIamMember?
These resources conflict because RuntimeTemplateIamPolicy manages the entire policy authoritatively, while RuntimeTemplateIamBinding and RuntimeTemplateIamMember manage specific roles or members. Using them together causes state conflicts.
Can I use RuntimeTemplateIamBinding and RuntimeTemplateIamMember together?
Yes, but only if they don’t grant privileges to the same role. Each role must be managed by only one resource type to avoid conflicts.
Identity & Role Configuration
What member identity formats are supported?
Supported formats include allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, and federated identities like principal://iam.googleapis.com/....
What format do custom roles need?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role.
Common Use Cases
Should I use RuntimeTemplateIamMember or RuntimeTemplateIamBinding to grant access?
Use RuntimeTemplateIamMember to add individual members to a role without affecting existing members. Use RuntimeTemplateIamBinding when you want to manage all members for a role authoritatively (replacing any existing members).

Using a different cloud?

Explore security guides for other cloud providers: