The gcp:dataplex/taskIamBinding:TaskIamBinding resource, part of the Pulumi GCP provider, manages IAM access control for Dataplex tasks by binding roles to members. This guide focuses on three capabilities: authoritative role binding to multiple members, non-authoritative single-member grants, and complete policy replacement.
These IAM resources reference existing Dataplex tasks and require task identifiers (taskId, lake, location, project). The examples are intentionally small. Combine them with your own Dataplex task infrastructure and IAM principals.
Grant a role to multiple members
Teams managing Dataplex tasks often need to grant the same role to multiple users or service accounts at once, such as giving viewer access to a data engineering team.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.dataplex.TaskIamBinding("binding", {
project: example.project,
location: example.location,
lake: example.lake,
taskId: example.taskId,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.dataplex.TaskIamBinding("binding",
project=example["project"],
location=example["location"],
lake=example["lake"],
task_id=example["taskId"],
role="roles/viewer",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/dataplex"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dataplex.NewTaskIamBinding(ctx, "binding", &dataplex.TaskIamBindingArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
TaskId: pulumi.Any(example.TaskId),
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.DataPlex.TaskIamBinding("binding", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
TaskId = example.TaskId,
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.dataplex.TaskIamBinding;
import com.pulumi.gcp.dataplex.TaskIamBindingArgs;
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 TaskIamBinding("binding", TaskIamBindingArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.taskId(example.taskId())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:dataplex:TaskIamBinding
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
taskId: ${example.taskId}
role: roles/viewer
members:
- user:jane@example.com
The TaskIamBinding resource is authoritative for the specified role. The members array lists all identities that should have this role; any existing members not in this list will be removed. The role property specifies which permission set to grant, and taskId, lake, and location identify the target task. This approach works well when you manage all members of a role together.
Add a single member to a role
When onboarding individual users or service accounts, you often need to grant access without affecting existing members of the same role.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.dataplex.TaskIamMember("member", {
project: example.project,
location: example.location,
lake: example.lake,
taskId: example.taskId,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.dataplex.TaskIamMember("member",
project=example["project"],
location=example["location"],
lake=example["lake"],
task_id=example["taskId"],
role="roles/viewer",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/dataplex"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dataplex.NewTaskIamMember(ctx, "member", &dataplex.TaskIamMemberArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
TaskId: pulumi.Any(example.TaskId),
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.DataPlex.TaskIamMember("member", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
TaskId = example.TaskId,
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.dataplex.TaskIamMember;
import com.pulumi.gcp.dataplex.TaskIamMemberArgs;
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 TaskIamMember("member", TaskIamMemberArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.taskId(example.taskId())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:dataplex:TaskIamMember
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
taskId: ${example.taskId}
role: roles/viewer
member: user:jane@example.com
The TaskIamMember resource is non-authoritative: it adds one member to a role without replacing existing members. The member property specifies a single identity (user, service account, group, or domain). This resource preserves other members of the same role, making it safer for incremental access grants. You can use multiple TaskIamMember resources for the same role, or combine them with TaskIamBinding resources as long as they target different roles.
Replace the entire IAM policy
Some workflows require complete control over a task’s IAM policy, replacing all existing bindings with a new policy document.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const admin = gcp.organizations.getIAMPolicy({
bindings: [{
role: "roles/viewer",
members: ["user:jane@example.com"],
}],
});
const policy = new gcp.dataplex.TaskIamPolicy("policy", {
project: example.project,
location: example.location,
lake: example.lake,
taskId: example.taskId,
policyData: admin.then(admin => admin.policyData),
});
import pulumi
import pulumi_gcp as gcp
admin = gcp.organizations.get_iam_policy(bindings=[{
"role": "roles/viewer",
"members": ["user:jane@example.com"],
}])
policy = gcp.dataplex.TaskIamPolicy("policy",
project=example["project"],
location=example["location"],
lake=example["lake"],
task_id=example["taskId"],
policy_data=admin.policy_data)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/dataplex"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
Bindings: []organizations.GetIAMPolicyBinding{
{
Role: "roles/viewer",
Members: []string{
"user:jane@example.com",
},
},
},
}, nil)
if err != nil {
return err
}
_, err = dataplex.NewTaskIamPolicy(ctx, "policy", &dataplex.TaskIamPolicyArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
TaskId: pulumi.Any(example.TaskId),
PolicyData: pulumi.String(admin.PolicyData),
})
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 admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
{
Bindings = new[]
{
new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
{
Role = "roles/viewer",
Members = new[]
{
"user:jane@example.com",
},
},
},
});
var policy = new Gcp.DataPlex.TaskIamPolicy("policy", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
TaskId = example.TaskId,
PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
import com.pulumi.gcp.dataplex.TaskIamPolicy;
import com.pulumi.gcp.dataplex.TaskIamPolicyArgs;
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) {
final var admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder()
.bindings(GetIAMPolicyBindingArgs.builder()
.role("roles/viewer")
.members("user:jane@example.com")
.build())
.build());
var policy = new TaskIamPolicy("policy", TaskIamPolicyArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.taskId(example.taskId())
.policyData(admin.policyData())
.build());
}
}
resources:
policy:
type: gcp:dataplex:TaskIamPolicy
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
taskId: ${example.taskId}
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
function: gcp:organizations:getIAMPolicy
arguments:
bindings:
- role: roles/viewer
members:
- user:jane@example.com
The TaskIamPolicy resource is fully authoritative: it replaces the entire IAM policy for the task. The policyData property accepts a policy document, typically retrieved from getIAMPolicy. This approach gives you complete control but removes any bindings not included in the policy. TaskIamPolicy cannot be used alongside TaskIamBinding or TaskIamMember resources; they will conflict over policy ownership.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control and authoritative vs non-authoritative binding. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as Dataplex tasks (referenced by taskId, lake, location) and GCP projects and IAM principals (users, service accounts, groups). They focus on configuring IAM bindings rather than provisioning the underlying tasks.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Custom role definitions and formatting
- Federated identity configuration
- Policy conflict resolution between resource types
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 Dataplex TaskIamBinding resource reference for all available configuration options.
Let's manage GCP Dataplex Task 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 & Compatibility
TaskIamPolicy is authoritative and replaces the entire IAM policy. TaskIamBinding is authoritative for a specific role, preserving other roles. TaskIamMember is non-authoritative and adds a single member to a role without affecting other members.TaskIamPolicy cannot be used with TaskIamBinding or TaskIamMember because they will conflict over the policy.TaskIamBinding or TaskIamMember, not both.IAM Configuration
[projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role.allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:projectid, projectEditor:projectid, projectViewer:projectid, and federated identities like principal://iam.googleapis.com/....