Manage GCP Compute Image IAM Permissions

The gcp:compute/imageIamMember:ImageIamMember resource, part of the Pulumi GCP provider, grants IAM permissions on Compute Engine images by adding individual members to roles without replacing existing permissions. This guide focuses on three capabilities: single-member grants, multi-member role bindings, and time-based access with IAM Conditions.

Image IAM resources reference existing Compute Engine images by name. The examples are intentionally small. Combine them with your own image resources and organizational IAM structure.

Grant image access to a single member

Teams sharing custom VM images across projects often need to grant specific users or service accounts access without modifying the entire policy.

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

const member = new gcp.compute.ImageIamMember("member", {
    project: example.project,
    image: example.name,
    role: "roles/compute.imageUser",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.compute.ImageIamMember("member",
    project=example["project"],
    image=example["name"],
    role="roles/compute.imageUser",
    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.NewImageIamMember(ctx, "member", &compute.ImageIamMemberArgs{
			Project: pulumi.Any(example.Project),
			Image:   pulumi.Any(example.Name),
			Role:    pulumi.String("roles/compute.imageUser"),
			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.ImageIamMember("member", new()
    {
        Project = example.Project,
        Image = example.Name,
        Role = "roles/compute.imageUser",
        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.ImageIamMember;
import com.pulumi.gcp.compute.ImageIamMemberArgs;
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 ImageIamMember("member", ImageIamMemberArgs.builder()
            .project(example.project())
            .image(example.name())
            .role("roles/compute.imageUser")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:compute:ImageIamMember
    properties:
      project: ${example.project}
      image: ${example.name}
      role: roles/compute.imageUser
      member: user:jane@example.com

The member property identifies who receives access (user, service account, group, or domain). The role property specifies what they can do; roles/compute.imageUser allows launching VMs from the image. ImageIamMember is non-authoritative, meaning it adds this member without affecting other members or roles on the image.

Grant time-limited access with IAM Conditions

Temporary access grants expire automatically when you attach IAM Conditions to member bindings, useful for contractor access or time-boxed testing.

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

const member = new gcp.compute.ImageIamMember("member", {
    project: example.project,
    image: example.name,
    role: "roles/compute.imageUser",
    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.ImageIamMember("member",
    project=example["project"],
    image=example["name"],
    role="roles/compute.imageUser",
    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.NewImageIamMember(ctx, "member", &compute.ImageIamMemberArgs{
			Project: pulumi.Any(example.Project),
			Image:   pulumi.Any(example.Name),
			Role:    pulumi.String("roles/compute.imageUser"),
			Member:  pulumi.String("user:jane@example.com"),
			Condition: &compute.ImageIamMemberConditionArgs{
				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.ImageIamMember("member", new()
    {
        Project = example.Project,
        Image = example.Name,
        Role = "roles/compute.imageUser",
        Member = "user:jane@example.com",
        Condition = new Gcp.Compute.Inputs.ImageIamMemberConditionArgs
        {
            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.ImageIamMember;
import com.pulumi.gcp.compute.ImageIamMemberArgs;
import com.pulumi.gcp.compute.inputs.ImageIamMemberConditionArgs;
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 ImageIamMember("member", ImageIamMemberArgs.builder()
            .project(example.project())
            .image(example.name())
            .role("roles/compute.imageUser")
            .member("user:jane@example.com")
            .condition(ImageIamMemberConditionArgs.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:ImageIamMember
    properties:
      project: ${example.project}
      image: ${example.name}
      role: roles/compute.imageUser
      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 adds time-based restrictions to the member grant. The expression uses CEL (Common Expression Language) to define when access is valid; this example expires at midnight on 2020-01-01. The title and description document the condition’s purpose. When the condition evaluates to false, the member loses access automatically.

Grant image access to multiple members at once

When multiple users need the same role, ImageIamBinding grants that role to a list of members in one resource.

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

const binding = new gcp.compute.ImageIamBinding("binding", {
    project: example.project,
    image: example.name,
    role: "roles/compute.imageUser",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.compute.ImageIamBinding("binding",
    project=example["project"],
    image=example["name"],
    role="roles/compute.imageUser",
    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.NewImageIamBinding(ctx, "binding", &compute.ImageIamBindingArgs{
			Project: pulumi.Any(example.Project),
			Image:   pulumi.Any(example.Name),
			Role:    pulumi.String("roles/compute.imageUser"),
			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.ImageIamBinding("binding", new()
    {
        Project = example.Project,
        Image = example.Name,
        Role = "roles/compute.imageUser",
        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.ImageIamBinding;
import com.pulumi.gcp.compute.ImageIamBindingArgs;
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 ImageIamBinding("binding", ImageIamBindingArgs.builder()
            .project(example.project())
            .image(example.name())
            .role("roles/compute.imageUser")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:compute:ImageIamBinding
    properties:
      project: ${example.project}
      image: ${example.name}
      role: roles/compute.imageUser
      members:
        - user:jane@example.com

The members property lists all identities that should have the role. ImageIamBinding is authoritative for the specified role, meaning it replaces any existing members for roles/compute.imageUser. Other roles on the image remain unchanged. Use ImageIamMember instead if you need to preserve existing members for the same role.

Beyond these examples

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

The examples reference pre-existing infrastructure such as Compute Engine images in the project. They focus on granting permissions rather than creating images or managing full IAM policies.

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

  • Full policy replacement (ImageIamPolicy)
  • Complex IAM Condition expressions (resource attributes, request context)
  • Custom role definitions
  • Cross-project image sharing patterns

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

Let's manage GCP Compute Image 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 Selection & Conflicts
Why are my ImageIam resources conflicting with each other?
ImageIamPolicy cannot be used with ImageIamBinding or ImageIamMember because they will fight over the policy. Additionally, ImageIamBinding and ImageIamMember will conflict if they manage the same role.
Which ImageIam resource should I use?

Choose based on your needs:

  • ImageIamPolicy: Authoritative, replaces the entire IAM policy
  • ImageIamBinding: Authoritative for a specific role, preserves other roles
  • ImageIamMember: Non-authoritative, adds a single member to a role while preserving other members
Can I use ImageIamBinding and ImageIamMember together?
Yes, but only if they don’t grant privileges to the same role. If they manage different roles, they can coexist safely.
IAM Member Configuration
What member identity formats can I use?

You can use:

  • allUsers or allAuthenticatedUsers for public/authenticated access
  • user:{email} for specific Google accounts
  • serviceAccount:{email} for service accounts
  • group:{email} for Google groups
  • domain:{domain} for G Suite domains
  • projectOwner:projectid, projectEditor:projectid, or projectViewer:projectid for project roles
  • Federated identities using principal identifiers (e.g., principal://iam.googleapis.com/...)
How do I grant image access to a service account?
Set member to serviceAccount:{emailid}, for example: serviceAccount:my-app@appspot.gserviceaccount.com.
Can I use custom IAM roles?
Yes, custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}.
IAM Conditions & Advanced Features
How do I add time-based or conditional access restrictions?
Use the condition property with title, description, and expression fields. For example, to expire access: expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")".
Are there limitations with IAM Conditions?
Yes, IAM Conditions have known limitations. Review the GCP documentation on IAM Conditions limitations if you encounter issues.
Resource Properties & Immutability
What properties can't I change after creating an ImageIamMember?
All properties are immutable: image, member, project, role, and condition. You must recreate the resource to change any of these.
How do I specify which project my image belongs to?
Set the project property. If not provided, it will be parsed from the image identifier or fall back to the provider’s default project.

Using a different cloud?

Explore security guides for other cloud providers: