The gcp:colab/runtimeTemplateIamPolicy:RuntimeTemplateIamPolicy resource, part of the Pulumi GCP provider, manages IAM access control for Colab Enterprise runtime templates using three distinct approaches: full policy replacement, role-level binding, or incremental member addition. This guide focuses on three capabilities: authoritative policy replacement, role-level member binding, and incremental member grants.
All three resources reference existing runtime templates by project, location, and name. RuntimeTemplateIamPolicy replaces the entire policy, RuntimeTemplateIamBinding is authoritative for a specific role, and RuntimeTemplateIamMember adds individual members non-authoritatively. The examples are intentionally small. Choose the resource that matches your access control needs and combine it with your runtime template infrastructure.
Replace the entire IAM policy authoritatively
When you need complete control over who can access a runtime template, you can set the entire IAM policy at once.
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 replaces any existing IAM policy with the one you define. The policyData property accepts output from getIAMPolicy, which structures bindings as role-to-members mappings. This approach is authoritative: any permissions not in your policy definition are removed. Use this when you want to ensure the policy matches your definition exactly, with no drift from manual changes.
Grant a role to multiple members at once
When multiple users or service accounts need the same level of access, you can bind them all to a single role.
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 but preserves other roles in the policy. The members property accepts a list of identities (users, service accounts, groups). If other bindings exist for different roles, they remain unchanged. This approach works well when you manage access by role and want to ensure a specific set of members has that role.
Add a single member to a role incrementally
When you need to grant access to one user without disturbing existing permissions, you can add individual members non-authoritatively.
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 adds a single member to a role without affecting other members for that role or other roles in the policy. The member property specifies one identity. This is the most flexible approach for incremental access grants, allowing multiple RuntimeTemplateIamMember resources to coexist as long as they don’t conflict on the same role-member pair.
Beyond these examples
These snippets focus on specific IAM management approaches: authoritative policy replacement, role-level binding management, and incremental member addition. They’re intentionally minimal rather than full access control systems.
The examples reference pre-existing infrastructure such as Colab Enterprise runtime templates (by project, location, and name). They focus on IAM policy configuration rather than provisioning the runtime templates themselves.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition blocks)
- Service account impersonation
- Custom role definitions
- 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 RuntimeTemplateIamPolicy resource reference for all available configuration options.
Let's manage GCP Colab Runtime Template IAM Policies
Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.
Try Pulumi Cloud for FREEFrequently Asked Questions
Resource Selection & Conflicts
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.RuntimeTemplateIamPolicy cannot be used with RuntimeTemplateIamBinding or RuntimeTemplateIamMember because they will conflict over the policy state.Configuration & Properties
location, project, and runtimeTemplate properties are immutable and cannot be changed after creation.[projects/my-project|organizations/my-org]/roles/my-custom-role when importing.