Manage GCP Cloud Tasks Queue IAM Bindings

The gcp:cloudtasks/queueIamBinding:QueueIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Cloud Tasks queues by granting a specific role to a list of members. This guide focuses on two capabilities: authoritative role binding for multiple members and non-authoritative single-member additions.

QueueIamBinding is one of three IAM resources for Cloud Tasks queues. It’s authoritative for a given role, meaning it controls the complete member list for that role while preserving other roles. QueueIamMember provides non-authoritative access, allowing you to add individual members without affecting others. The examples are intentionally small. Combine them with your own queue references and identity management.

Grant a role to multiple members at once

Teams managing Cloud Tasks queues often need to grant the same role to multiple users, service accounts, or groups.

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

const binding = new gcp.cloudtasks.QueueIamBinding("binding", {
    project: _default.project,
    location: _default.location,
    name: _default.name,
    role: "roles/viewer",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.cloudtasks.QueueIamBinding("binding",
    project=default["project"],
    location=default["location"],
    name=default["name"],
    role="roles/viewer",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/cloudtasks"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudtasks.NewQueueIamBinding(ctx, "binding", &cloudtasks.QueueIamBindingArgs{
			Project:  pulumi.Any(_default.Project),
			Location: pulumi.Any(_default.Location),
			Name:     pulumi.Any(_default.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.CloudTasks.QueueIamBinding("binding", new()
    {
        Project = @default.Project,
        Location = @default.Location,
        Name = @default.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.cloudtasks.QueueIamBinding;
import com.pulumi.gcp.cloudtasks.QueueIamBindingArgs;
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 QueueIamBinding("binding", QueueIamBindingArgs.builder()
            .project(default_.project())
            .location(default_.location())
            .name(default_.name())
            .role("roles/viewer")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:cloudtasks:QueueIamBinding
    properties:
      project: ${default.project}
      location: ${default.location}
      name: ${default.name}
      role: roles/viewer
      members:
        - user:jane@example.com

The role property specifies which IAM role to grant (e.g., “roles/viewer”). The members array lists all identities that receive this role; QueueIamBinding replaces any existing members for this role. The project, location, and name properties identify the target queue. This resource is authoritative for the specified role: if you remove a member from the list, they lose access.

Add a single member to a role incrementally

When you need to add individual users or service accounts without affecting other members of the same role, QueueIamMember provides non-authoritative access control.

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

const member = new gcp.cloudtasks.QueueIamMember("member", {
    project: _default.project,
    location: _default.location,
    name: _default.name,
    role: "roles/viewer",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.cloudtasks.QueueIamMember("member",
    project=default["project"],
    location=default["location"],
    name=default["name"],
    role="roles/viewer",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/cloudtasks"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudtasks.NewQueueIamMember(ctx, "member", &cloudtasks.QueueIamMemberArgs{
			Project:  pulumi.Any(_default.Project),
			Location: pulumi.Any(_default.Location),
			Name:     pulumi.Any(_default.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.CloudTasks.QueueIamMember("member", new()
    {
        Project = @default.Project,
        Location = @default.Location,
        Name = @default.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.cloudtasks.QueueIamMember;
import com.pulumi.gcp.cloudtasks.QueueIamMemberArgs;
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 QueueIamMember("member", QueueIamMemberArgs.builder()
            .project(default_.project())
            .location(default_.location())
            .name(default_.name())
            .role("roles/viewer")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:cloudtasks:QueueIamMember
    properties:
      project: ${default.project}
      location: ${default.location}
      name: ${default.name}
      role: roles/viewer
      member: user:jane@example.com

The member property specifies a single identity to add to the role. Unlike QueueIamBinding, this resource doesn’t replace existing members; it adds one member to the role. You can create multiple QueueIamMember resources for the same role, and they coexist without conflict. This approach works well when different teams manage access for different users.

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 Cloud Tasks queues and a GCP project with configured location. They focus on configuring IAM bindings rather than provisioning the queues themselves.

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

  • Conditional IAM bindings (condition property)
  • Full policy replacement (QueueIamPolicy resource)
  • 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 Cloud Tasks QueueIamBinding resource reference for all available configuration options.

Let's manage GCP Cloud Tasks Queue 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
Can I use QueueIamPolicy with QueueIamBinding or QueueIamMember?
No, gcp.cloudtasks.QueueIamPolicy cannot be used with gcp.cloudtasks.QueueIamBinding or gcp.cloudtasks.QueueIamMember because they will conflict over policy management.
Can I use QueueIamBinding and QueueIamMember together?
Yes, but only if they manage different roles. Using both for the same role will cause conflicts.
What's the difference between QueueIamPolicy, QueueIamBinding, and QueueIamMember?
gcp.cloudtasks.QueueIamPolicy is fully authoritative and replaces the entire IAM policy. gcp.cloudtasks.QueueIamBinding is authoritative for a specific role, preserving other roles. gcp.cloudtasks.QueueIamMember is non-authoritative, adding members without affecting existing ones for that role.
Which IAM resource should I use for my Cloud Tasks queue?
Use gcp.cloudtasks.QueueIamPolicy for complete policy control, gcp.cloudtasks.QueueIamBinding to manage all members for specific roles, or gcp.cloudtasks.QueueIamMember to add individual members without affecting others.
IAM Configuration
How do I format custom roles in the role parameter?
Custom roles must use the full format: [projects|organizations]/{parent-name}/roles/{role-name}. For example, projects/my-project/roles/my-custom-role or organizations/my-org/roles/my-custom-role.
What member identity formats are supported?
Supported formats include allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, and federated identities like principal://iam.googleapis.com/....
Import & Management
How do I import IAM resources for Cloud Tasks queues?
Import syntax varies by resource type. For QueueIamMember, use: resource role member (e.g., "projects/.../queues/myqueue roles/viewer user:jane@example.com"). For QueueIamBinding, use: resource role (e.g., "projects/.../queues/myqueue roles/viewer"). For QueueIamPolicy, use just the resource identifier.

Using a different cloud?

Explore security guides for other cloud providers: