The gcp:compute/instantSnapshotIamBinding:InstantSnapshotIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Compute Engine instant snapshots, controlling which identities can access snapshot resources. This guide focuses on three capabilities: binding roles to multiple members, time-limited access with IAM Conditions, and non-authoritative member additions.
IAM bindings reference existing instant snapshots and grant access to users, service accounts, or groups. The examples are intentionally small. Combine them with your own snapshot resources and organizational IAM principals.
Grant a role to multiple members at once
Teams managing snapshot access often need to assign the same role to multiple users simultaneously, ensuring consistent permissions across a group.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.compute.InstantSnapshotIamBinding("binding", {
project: _default.project,
zone: _default.zone,
name: _default.name,
role: "roles/compute.storageAdmin",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.compute.InstantSnapshotIamBinding("binding",
project=default["project"],
zone=default["zone"],
name=default["name"],
role="roles/compute.storageAdmin",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstantSnapshotIamBinding(ctx, "binding", &compute.InstantSnapshotIamBindingArgs{
Project: pulumi.Any(_default.Project),
Zone: pulumi.Any(_default.Zone),
Name: pulumi.Any(_default.Name),
Role: pulumi.String("roles/compute.storageAdmin"),
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.Compute.InstantSnapshotIamBinding("binding", new()
{
Project = @default.Project,
Zone = @default.Zone,
Name = @default.Name,
Role = "roles/compute.storageAdmin",
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.compute.InstantSnapshotIamBinding;
import com.pulumi.gcp.compute.InstantSnapshotIamBindingArgs;
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 InstantSnapshotIamBinding("binding", InstantSnapshotIamBindingArgs.builder()
.project(default_.project())
.zone(default_.zone())
.name(default_.name())
.role("roles/compute.storageAdmin")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:compute:InstantSnapshotIamBinding
properties:
project: ${default.project}
zone: ${default.zone}
name: ${default.name}
role: roles/compute.storageAdmin
members:
- user:jane@example.com
The binding resource is authoritative for the specified role: it replaces any existing member list for that role on the snapshot. The members array accepts user emails, service account emails, groups, and special identifiers like allUsers. The role property specifies a predefined or custom IAM role; the name, zone, and project properties identify which snapshot receives the binding.
Apply time-limited access with IAM Conditions
Temporary access grants expire automatically when IAM Conditions evaluate to false, eliminating manual cleanup for contractors or time-bound projects.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.compute.InstantSnapshotIamBinding("binding", {
project: _default.project,
zone: _default.zone,
name: _default.name,
role: "roles/compute.storageAdmin",
members: ["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
binding = gcp.compute.InstantSnapshotIamBinding("binding",
project=default["project"],
zone=default["zone"],
name=default["name"],
role="roles/compute.storageAdmin",
members=["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/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstantSnapshotIamBinding(ctx, "binding", &compute.InstantSnapshotIamBindingArgs{
Project: pulumi.Any(_default.Project),
Zone: pulumi.Any(_default.Zone),
Name: pulumi.Any(_default.Name),
Role: pulumi.String("roles/compute.storageAdmin"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
Condition: &compute.InstantSnapshotIamBindingConditionArgs{
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 binding = new Gcp.Compute.InstantSnapshotIamBinding("binding", new()
{
Project = @default.Project,
Zone = @default.Zone,
Name = @default.Name,
Role = "roles/compute.storageAdmin",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Compute.Inputs.InstantSnapshotIamBindingConditionArgs
{
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.compute.InstantSnapshotIamBinding;
import com.pulumi.gcp.compute.InstantSnapshotIamBindingArgs;
import com.pulumi.gcp.compute.inputs.InstantSnapshotIamBindingConditionArgs;
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 InstantSnapshotIamBinding("binding", InstantSnapshotIamBindingArgs.builder()
.project(default_.project())
.zone(default_.zone())
.name(default_.name())
.role("roles/compute.storageAdmin")
.members("user:jane@example.com")
.condition(InstantSnapshotIamBindingConditionArgs.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:
binding:
type: gcp:compute:InstantSnapshotIamBinding
properties:
project: ${default.project}
zone: ${default.zone}
name: ${default.name}
role: roles/compute.storageAdmin
members:
- 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 temporal or attribute-based constraints to the role binding. The expression property uses CEL (Common Expression Language) to define when the binding is active; here, it 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.
Add a single member to an existing role
When you need to grant access to one additional user without affecting other members already assigned to the role, non-authoritative member resources preserve existing grants.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.compute.InstantSnapshotIamMember("member", {
project: _default.project,
zone: _default.zone,
name: _default.name,
role: "roles/compute.storageAdmin",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.compute.InstantSnapshotIamMember("member",
project=default["project"],
zone=default["zone"],
name=default["name"],
role="roles/compute.storageAdmin",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstantSnapshotIamMember(ctx, "member", &compute.InstantSnapshotIamMemberArgs{
Project: pulumi.Any(_default.Project),
Zone: pulumi.Any(_default.Zone),
Name: pulumi.Any(_default.Name),
Role: pulumi.String("roles/compute.storageAdmin"),
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.Compute.InstantSnapshotIamMember("member", new()
{
Project = @default.Project,
Zone = @default.Zone,
Name = @default.Name,
Role = "roles/compute.storageAdmin",
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.compute.InstantSnapshotIamMember;
import com.pulumi.gcp.compute.InstantSnapshotIamMemberArgs;
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 InstantSnapshotIamMember("member", InstantSnapshotIamMemberArgs.builder()
.project(default_.project())
.zone(default_.zone())
.name(default_.name())
.role("roles/compute.storageAdmin")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:compute:InstantSnapshotIamMember
properties:
project: ${default.project}
zone: ${default.zone}
name: ${default.name}
role: roles/compute.storageAdmin
member: user:jane@example.com
The InstantSnapshotIamMember resource adds a single member to a role without replacing other members. Unlike InstantSnapshotIamBinding, which is authoritative for the entire role, this resource is non-authoritative: it only ensures the specified member has the role. Use this when multiple teams manage access to the same snapshot independently.
Beyond these examples
These snippets focus on specific IAM binding features: role binding with multiple members, time-based conditional access, and non-authoritative member grants. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as instant snapshots (by name, zone, project) and IAM principals (users, service accounts, groups). They focus on configuring access rather than creating the underlying snapshot or identity resources.
To keep things focused, common IAM patterns are omitted, including:
- Full policy replacement (InstantSnapshotIamPolicy)
- Complex condition expressions beyond time-based expiry
- Custom role definitions and formatting
- Federated identity and workload identity pool configuration
These omissions are intentional: the goal is to illustrate how each IAM binding feature is wired, not provide drop-in access control modules. See the InstantSnapshotIamBinding resource reference for all available configuration options.
Let's manage GCP Instant Snapshot IAM Bindings
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
InstantSnapshotIamPolicy is authoritative and replaces the entire IAM policy. InstantSnapshotIamBinding is authoritative for a specific role, managing all members for that role while preserving other roles. InstantSnapshotIamMember is non-authoritative, adding individual members without affecting other members or roles.InstantSnapshotIamPolicy cannot be used with InstantSnapshotIamBinding or InstantSnapshotIamMember as they will conflict over policy control. Choose one approach: use Policy for full control, or use Binding/Member for granular management.IAM Configuration
You can use multiple identity formats in the members array:
- allUsers or allAuthenticatedUsers for public/authenticated access
- user:{email}, serviceAccount:{email}, group:{email} for specific identities
- domain:{domain} for G Suite domains
- projectOwner/Editor/Viewer:{projectid} for project-level roles
- Federated identities using principal:// format for workload/workforce identity pools
[projects|organizations]/{parent-name}/roles/{role-name} in the role property.name, project, zone, and role are all immutable. Changing these properties requires recreating the resource.IAM Conditions
condition block with title, description, and expression. For example, to expire access at a specific time, use expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")".