Manage GCP Colab Runtime Template IAM Bindings

The gcp:colab/runtimeTemplateIamBinding:RuntimeTemplateIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Colab Enterprise runtime templates. This guide focuses on two capabilities: granting roles to multiple members and adding individual members to roles.

IAM bindings reference existing runtime templates and require valid GCP identities. The examples are intentionally small. Combine them with your own runtime template resources and identity management.

Grant a role to multiple members

Teams managing runtime templates often need to grant the same role to multiple users or service accounts at once, such as giving viewer access to a team of data scientists.

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 is authoritative for the specified role: it replaces all members for that role. The members array accepts user accounts, service accounts, groups, and special identifiers like allAuthenticatedUsers. The runtimeTemplate property identifies which template to bind permissions to, while location specifies the GCP region.

Add a single member to a role

When onboarding individual users or granting access to specific service accounts, you can add members one at a time without affecting existing role assignments.

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 RuntimeTemplateIamMember resource is non-authoritative: it adds one member to a role without replacing existing members. Use member (singular) instead of members (plural) to specify a single identity. This resource can coexist with RuntimeTemplateIamBinding resources as long as they don’t manage the same role.

Beyond these examples

These snippets focus on specific IAM binding features: role-based access control and authoritative vs non-authoritative member management. They’re intentionally minimal rather than full access control configurations.

The examples reference pre-existing infrastructure such as Colab Enterprise runtime templates and GCP project and location configuration. They focus on configuring IAM bindings rather than provisioning the underlying templates.

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

  • Conditional IAM bindings (condition property)
  • Full policy replacement (RuntimeTemplateIamPolicy)
  • Custom role definitions
  • Federated identity configuration

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

Let's manage GCP Colab Runtime Template IAM Bindings

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
Which IAM resource should I use to manage RuntimeTemplate permissions?
You have three options: gcp.colab.RuntimeTemplateIamPolicy sets the entire IAM policy (authoritative), gcp.colab.RuntimeTemplateIamBinding manages all members for a specific role (authoritative per role), and gcp.colab.RuntimeTemplateIamMember adds individual members to a role (non-authoritative).
Can I mix different IAM resource types for the same RuntimeTemplate?
RuntimeTemplateIamPolicy cannot be used with RuntimeTemplateIamBinding or RuntimeTemplateIamMember, as they will conflict. However, you can use RuntimeTemplateIamBinding and RuntimeTemplateIamMember together, but only if they don’t manage the same role.
What properties can't I change after creating an IAM binding?
The location, project, runtimeTemplate, role, and condition properties are all immutable after creation.
IAM Configuration
How do I specify a custom role?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role.
What member identity formats are supported?
You can use allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, or federated identities like principal://iam.googleapis.com/....
Resource Management
How do I import an existing IAM binding?
Use pulumi import with space-delimited identifiers. For bindings, use resource_id role (e.g., "projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates/{{runtime_template}} roles/viewer"). For members, add the member identity. For policy, use just the resource ID.

Using a different cloud?

Explore security guides for other cloud providers: