Manage GCP Dataplex Task IAM Policies

The gcp:dataplex/taskIamPolicy:TaskIamPolicy resource, part of the Pulumi GCP provider, manages IAM permissions for Dataplex tasks. This guide focuses on three approaches: authoritative policy replacement (TaskIamPolicy), role-level member binding (TaskIamBinding), and individual member grants (TaskIamMember).

These resources reference existing Dataplex tasks within lakes. TaskIamPolicy cannot be used with TaskIamBinding or TaskIamMember on the same task, as they conflict over policy ownership. TaskIamBinding and TaskIamMember can coexist if they manage different roles. The examples are intentionally small. Combine them with your own task definitions and organizational IAM structure.

Replace the entire IAM policy for a task

When you need complete control over task permissions, you can set the entire IAM policy at once.

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

TaskIamPolicy is authoritative: it replaces any existing policy on the task. The policyData comes from the getIAMPolicy data source, which defines bindings (role-to-members mappings). The task is identified by project, location, lake, and taskId. Use this when you want to define the complete permission set in one place, but be aware it will remove any permissions not explicitly listed.

Grant a role to multiple members

When multiple users or service accounts need the same access level, bind them all to a single role.

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

TaskIamBinding is authoritative for one role: it sets the complete member list for that role while preserving other roles on the task. The members array accepts user, serviceAccount, group, and domain identities. This approach works well when you manage teams or groups that need uniform access, and you want to keep role assignments together in your infrastructure code.

Add a single member to a role

When you need to grant access to one additional user without affecting existing members, add them individually.

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

TaskIamMember is non-authoritative: it adds one member to a role without removing others. The member property takes a single identity (user, serviceAccount, group, or domain). This is useful when permissions are managed across multiple Pulumi stacks or when you want to grant access without knowing or affecting the full member list for a role.

Beyond these examples

These snippets focus on specific IAM management approaches: authoritative policy replacement, role-level binding management, and individual member grants. They’re intentionally minimal rather than full access control systems.

The examples reference pre-existing infrastructure such as Dataplex tasks within lakes, and GCP projects and locations. They focus on IAM configuration rather than provisioning the tasks themselves.

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

  • Conditional IAM bindings (condition blocks)
  • Custom role definitions
  • Service account creation and management
  • Audit logging 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 Dataplex TaskIamPolicy resource reference for all available configuration options.

Let's manage GCP Dataplex Task IAM Policies

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
Which IAM resource should I use to manage Dataplex Task permissions?

You have three options:

  1. gcp.dataplex.TaskIamPolicy - Authoritative, replaces entire policy
  2. gcp.dataplex.TaskIamBinding - Authoritative for a specific role, preserves other roles
  3. gcp.dataplex.TaskIamMember - Non-authoritative, adds individual members without affecting others
Can I use TaskIamPolicy with TaskIamBinding or TaskIamMember?
No, gcp.dataplex.TaskIamPolicy conflicts with gcp.dataplex.TaskIamBinding and gcp.dataplex.TaskIamMember because they compete for policy control. Choose one approach and stick with it.
Can I use TaskIamBinding and TaskIamMember together?
Yes, but only if they manage different roles. Using both gcp.dataplex.TaskIamBinding and gcp.dataplex.TaskIamMember for the same role causes conflicts.
Configuration & Properties
What properties are required to create a TaskIamPolicy?
You must provide lake, location, project, taskId (to identify the task), and policyData (from gcp.organizations.getIAMPolicy data source).
What properties can't be changed after creating a TaskIamPolicy?
The lake, location, project, and taskId properties are immutable. Only policyData can be updated.
Import & Migration
What formats can I use to import a TaskIamPolicy?

You can import using any of these formats:

  • projects/{{project}}/locations/{{location}}/lakes/{{lake}}/tasks/{{task_id}}
  • {{project}}/{{location}}/{{lake}}/{{task_id}}
  • {{location}}/{{lake}}/{{task_id}}
  • {{task_id}}

Missing values are taken from the provider configuration.

How do I import a TaskIamPolicy with a custom role?
Use the full custom role name in the format [projects/my-project|organizations/my-org]/roles/my-custom-role when importing.

Using a different cloud?

Explore security guides for other cloud providers: