The gcp:dataplex/assetIamPolicy:AssetIamPolicy resource, part of the Pulumi GCP provider, manages IAM policies for Dataplex assets, controlling who can access and operate on data lake resources. This guide focuses on three approaches: authoritative policy replacement (AssetIamPolicy), role-level member binding (AssetIamBinding), and incremental member addition (AssetIamMember).
These resources reference existing Dataplex assets by their hierarchical identifiers (project, location, lake, zone, asset name). The examples are intentionally small. Combine them with your own Dataplex infrastructure and organizational IAM policies.
Replace the entire IAM policy for an asset
When you need complete control over asset access, you can set the entire IAM policy at once, replacing any existing permissions.
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.AssetIamPolicy("policy", {
project: example.project,
location: example.location,
lake: example.lake,
dataplexZone: example.dataplexZone,
asset: example.name,
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.AssetIamPolicy("policy",
project=example["project"],
location=example["location"],
lake=example["lake"],
dataplex_zone=example["dataplexZone"],
asset=example["name"],
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.NewAssetIamPolicy(ctx, "policy", &dataplex.AssetIamPolicyArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
DataplexZone: pulumi.Any(example.DataplexZone),
Asset: pulumi.Any(example.Name),
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.AssetIamPolicy("policy", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
DataplexZone = example.DataplexZone,
Asset = example.Name,
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.AssetIamPolicy;
import com.pulumi.gcp.dataplex.AssetIamPolicyArgs;
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 AssetIamPolicy("policy", AssetIamPolicyArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.dataplexZone(example.dataplexZone())
.asset(example.name())
.policyData(admin.policyData())
.build());
}
}
resources:
policy:
type: gcp:dataplex:AssetIamPolicy
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
dataplexZone: ${example.dataplexZone}
asset: ${example.name}
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
function: gcp:organizations:getIAMPolicy
arguments:
bindings:
- role: roles/viewer
members:
- user:jane@example.com
AssetIamPolicy is authoritative: it replaces the entire IAM policy for the asset. The policyData property accepts output from getIAMPolicy, which defines bindings between roles and members. This approach cannot be used alongside AssetIamBinding or AssetIamMember, as they would conflict over policy ownership.
Grant a role to multiple members at once
Teams often need to grant the same role to several users without affecting other roles already assigned to the asset.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.dataplex.AssetIamBinding("binding", {
project: example.project,
location: example.location,
lake: example.lake,
dataplexZone: example.dataplexZone,
asset: example.name,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.dataplex.AssetIamBinding("binding",
project=example["project"],
location=example["location"],
lake=example["lake"],
dataplex_zone=example["dataplexZone"],
asset=example["name"],
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.NewAssetIamBinding(ctx, "binding", &dataplex.AssetIamBindingArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
DataplexZone: pulumi.Any(example.DataplexZone),
Asset: pulumi.Any(example.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.DataPlex.AssetIamBinding("binding", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
DataplexZone = example.DataplexZone,
Asset = example.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.dataplex.AssetIamBinding;
import com.pulumi.gcp.dataplex.AssetIamBindingArgs;
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 AssetIamBinding("binding", AssetIamBindingArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.dataplexZone(example.dataplexZone())
.asset(example.name())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:dataplex:AssetIamBinding
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
dataplexZone: ${example.dataplexZone}
asset: ${example.name}
role: roles/viewer
members:
- user:jane@example.com
AssetIamBinding is authoritative for a single role: it sets the complete member list for that role while preserving other roles. The members property accepts an array of identities (users, service accounts, groups). You can use multiple AssetIamBinding resources for different roles, or combine them with AssetIamMember resources as long as they don’t target the same role.
Add a single member to a role incrementally
When you need to grant access to one additional user without modifying existing members, incremental addition avoids conflicts with other IAM configurations.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.dataplex.AssetIamMember("member", {
project: example.project,
location: example.location,
lake: example.lake,
dataplexZone: example.dataplexZone,
asset: example.name,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.dataplex.AssetIamMember("member",
project=example["project"],
location=example["location"],
lake=example["lake"],
dataplex_zone=example["dataplexZone"],
asset=example["name"],
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.NewAssetIamMember(ctx, "member", &dataplex.AssetIamMemberArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
DataplexZone: pulumi.Any(example.DataplexZone),
Asset: pulumi.Any(example.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.DataPlex.AssetIamMember("member", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
DataplexZone = example.DataplexZone,
Asset = example.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.dataplex.AssetIamMember;
import com.pulumi.gcp.dataplex.AssetIamMemberArgs;
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 AssetIamMember("member", AssetIamMemberArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.dataplexZone(example.dataplexZone())
.asset(example.name())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:dataplex:AssetIamMember
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
dataplexZone: ${example.dataplexZone}
asset: ${example.name}
role: roles/viewer
member: user:jane@example.com
AssetIamMember is non-authoritative: it adds one member to a role without affecting other members for that role or other roles on the asset. The member property accepts a single identity. This resource works well when multiple teams manage access independently, as each can add members without coordinating policy updates.
Beyond these examples
These snippets focus on specific IAM management approaches: authoritative policy replacement, role-level binding management, and incremental member addition. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as Dataplex assets (identified by project, location, lake, zone, and asset name). They focus on configuring IAM policies rather than provisioning the underlying data lake resources.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition blocks)
- Custom role definitions
- Policy conflict resolution strategies
- 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 AssetIamPolicy resource reference for all available configuration options.
Let's manage GCP Dataplex Asset IAM Policies
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
AssetIamPolicy cannot be used with AssetIamBinding or AssetIamMember as they will conflict. However, AssetIamBinding and AssetIamMember can be used together if they don’t grant the same role.AssetIamPolicy is authoritative and replaces the entire policy. AssetIamBinding is authoritative for a specific role, preserving other roles. AssetIamMember is non-authoritative, adding a single member to a role while preserving other members.AssetIamPolicy when you need full control over the entire IAM policy. Use AssetIamBinding when you want to manage a specific role while preserving other roles in the policy.Configuration & Setup
gcp.organizations.getIAMPolicy data source to generate policyData. Pass the resulting policyData output to the AssetIamPolicy resource.asset, dataplexZone, lake, location, and project to identify the parent resource. AssetIamPolicy also requires policyData, while AssetIamBinding and AssetIamMember require role and member information.asset, dataplexZone, lake, location, and project are all immutable and cannot be changed after creation.Import & Advanced Usage
AssetIamPolicy, use the resource identifier. For AssetIamBinding, add the role (space-delimited). For AssetIamMember, add both role and member identity (space-delimited). The resource identifier can use four formats, from full path to just the asset name.[projects/my-project|organizations/my-org]/roles/my-custom-role.