The gcp:cloudtasks/queueIamBinding:QueueIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Cloud Tasks queues. This guide focuses on two capabilities: authoritative role binding that replaces all members for a role, and non-authoritative member addition that preserves existing members.
IAM bindings reference existing Cloud Tasks queues and grant access to users, service accounts, groups, or special identities. The examples are intentionally small. Combine them with your own queue infrastructure 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
QueueIamBinding is authoritative for the specified role: it replaces all existing members for that role with the members list you provide. The role property specifies which permission set to grant (e.g., “roles/viewer”). The members array accepts user emails, service account emails, groups, domains, and special identities like “allUsers”. Each binding references a queue by project, location, and name.
Add a single member to a role incrementally
When you need to grant access to one user without affecting other members, QueueIamMember adds a single member non-authoritatively.
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
QueueIamMember preserves other members for the same role, making it safe to use alongside other QueueIamMember resources. The member property (singular) specifies one identity to add. This approach works well when multiple teams manage access independently, or when you’re adding access incrementally without knowing the full member list.
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 queues or managing identity providers.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Custom role definitions
- Policy-level management (QueueIamPolicy)
- Federated identity and workload identity pool 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 FREEFrequently Asked Questions
Resource Selection & Conflicts
gcp.cloudtasks.QueueIamPolicy is fully authoritative and replaces the entire IAM policy. gcp.cloudtasks.QueueIamBinding is authoritative for a specific role but preserves other roles. gcp.cloudtasks.QueueIamMember is non-authoritative and adds a single member while preserving other members for that role.gcp.cloudtasks.QueueIamPolicy cannot be used with gcp.cloudtasks.QueueIamBinding or gcp.cloudtasks.QueueIamMember because they will conflict over the policy.IAM Configuration
The members array supports multiple formats:
allUsersandallAuthenticatedUsersfor public/authenticated accessuser:{email},serviceAccount:{email},group:{email}for specific identitiesdomain:{domain}for G Suite domainsprojectOwner:,projectEditor:,projectViewer:with project ID- Federated identities using
principal://format
[projects|organizations]/{parent-name}/roles/{role-name}. For example, projects/my-project/roles/my-custom-role.gcp.cloudtasks.QueueIamBinding per role. Each binding manages a different role’s member list.Resource Properties
location, name, project, and role properties are all immutable and require resource replacement if changed.You can import using any of these formats:
projects/{{project}}/locations/{{location}}/queues/{{name}}{{project}}/{{location}}/{{name}}{{location}}/{{name}}{{name}}
Variables not provided are taken from the provider configuration.