Manage GCP Instant Snapshot IAM Permissions

The gcp:compute/instantSnapshotIamMember:InstantSnapshotIamMember resource, part of the Pulumi GCP provider, grants IAM roles to individual members for Compute Engine instant snapshots without affecting other role assignments. This guide focuses on three capabilities: single-member role grants, time-based IAM Conditions, and multi-member role management.

IAM resources for instant snapshots reference existing snapshots and require a configured GCP project and zone. The examples are intentionally small. Combine them with your own snapshot resources 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 affecting others who already have that role.

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 member property specifies who receives access using formats like “user:jane@example.com” or “serviceAccount:app@project.iam.gserviceaccount.com”. The role property defines what permissions they get. InstantSnapshotIamMember is non-authoritative, meaning it adds this member without removing others who already have the same role.

Grant time-limited access with IAM Conditions

Teams often need temporary access that expires automatically without manual cleanup.

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",
    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

member = gcp.compute.InstantSnapshotIamMember("member",
    project=default["project"],
    zone=default["zone"],
    name=default["name"],
    role="roles/compute.storageAdmin",
    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/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"),
			Condition: &compute.InstantSnapshotIamMemberConditionArgs{
				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 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",
        Condition = new Gcp.Compute.Inputs.InstantSnapshotIamMemberConditionArgs
        {
            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.InstantSnapshotIamMember;
import com.pulumi.gcp.compute.InstantSnapshotIamMemberArgs;
import com.pulumi.gcp.compute.inputs.InstantSnapshotIamMemberConditionArgs;
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")
            .condition(InstantSnapshotIamMemberConditionArgs.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:
  member:
    type: gcp:compute:InstantSnapshotIamMember
    properties:
      project: ${default.project}
      zone: ${default.zone}
      name: ${default.name}
      role: roles/compute.storageAdmin
      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 attaches restrictions to the role grant. The expression property uses CEL (Common Expression Language) to define when access is valid; here, it expires at midnight on 2020-01-01. The title and description help identify the condition’s purpose in audit logs and the console.

Grant a role to multiple members at once

When several users or service accounts need the same role, InstantSnapshotIamBinding manages them as 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 members property lists all identities that should have this role. InstantSnapshotIamBinding is authoritative for the specific role, meaning it replaces any existing members for that role. If you need to add members without affecting others, use InstantSnapshotIamMember instead.

Beyond these examples

These snippets focus on specific IAM features: single-member and multi-member role grants, and IAM Conditions for time-based access. They’re intentionally minimal rather than full access control configurations.

The examples reference pre-existing infrastructure such as Compute Engine instant snapshots and a GCP project with configured zone. They focus on granting access rather than creating the underlying snapshot resources.

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

  • Full policy replacement (InstantSnapshotIamPolicy)
  • Attribute-based conditions beyond time restrictions
  • Custom role definitions
  • Federated identity configuration

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 InstantSnapshotIamMember resource reference for all available configuration options.

Let's manage GCP Instant Snapshot IAM Permissions

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
Can I use InstantSnapshotIamPolicy with InstantSnapshotIamBinding or InstantSnapshotIamMember?
No, gcp.compute.InstantSnapshotIamPolicy cannot be used with gcp.compute.InstantSnapshotIamBinding or gcp.compute.InstantSnapshotIamMember because they will conflict over policy management. Use only one approach: Policy (fully authoritative), Binding (authoritative per role), or Member (non-authoritative per member).
Can I use InstantSnapshotIamBinding and InstantSnapshotIamMember together?
Yes, but only if they grant different roles. Using both resources for the same role will cause conflicts.
IAM Configuration
What member identity formats are supported?

You can use multiple identity formats in the member property:

  • 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 identifiers (e.g., principal://iam.googleapis.com/...)
How do I specify a custom IAM role?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name} in the role property.
How do I add time-based or conditional access to an IAM binding?
Use the condition property with title, description, and expression fields. For example, to expire access at a specific time: expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")".
What are the limitations of IAM Conditions?
IAM Conditions are supported but have known limitations. Review the GCP documentation on IAM Conditions limitations if you encounter issues.
Resource Lifecycle
Can I change the member, role, or other properties after creation?
No, all properties (member, role, name, project, zone, condition) are immutable and require resource replacement if changed.

Using a different cloud?

Explore security guides for other cloud providers: