The gcp:dataplex/zoneIamPolicy:ZoneIamPolicy resource, part of the Pulumi GCP provider, manages IAM policies for Dataplex zones, controlling who can access zone resources and what actions they can perform. This guide focuses on three approaches: authoritative policy replacement (ZoneIamPolicy), role-level member binding (ZoneIamBinding), and individual member grants (ZoneIamMember).
These resources reference existing Dataplex zones by project, location, lake, and zone name. The examples are intentionally small. Combine them with your own zone infrastructure and access requirements.
Replace the entire IAM policy for a zone
When you need complete control over zone 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.ZoneIamPolicy("policy", {
project: example.project,
location: example.location,
lake: example.lake,
dataplexZone: 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.ZoneIamPolicy("policy",
project=example["project"],
location=example["location"],
lake=example["lake"],
dataplex_zone=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.NewZoneIamPolicy(ctx, "policy", &dataplex.ZoneIamPolicyArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
DataplexZone: 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.ZoneIamPolicy("policy", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
DataplexZone = 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.ZoneIamPolicy;
import com.pulumi.gcp.dataplex.ZoneIamPolicyArgs;
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 ZoneIamPolicy("policy", ZoneIamPolicyArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.dataplexZone(example.name())
.policyData(admin.policyData())
.build());
}
}
resources:
policy:
type: gcp:dataplex:ZoneIamPolicy
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
dataplexZone: ${example.name}
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
function: gcp:organizations:getIAMPolicy
arguments:
bindings:
- role: roles/viewer
members:
- user:jane@example.com
The ZoneIamPolicy resource is authoritative: it replaces the zone’s entire IAM policy with the policyData you provide. The getIAMPolicy data source generates policy data from bindings you define. Any permissions not included in policyData are removed when the resource applies.
Grant a role to multiple members
When multiple users or service accounts need the same level of access, you can bind them all to a single role without affecting other role assignments.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.dataplex.ZoneIamBinding("binding", {
project: example.project,
location: example.location,
lake: example.lake,
dataplexZone: example.name,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.dataplex.ZoneIamBinding("binding",
project=example["project"],
location=example["location"],
lake=example["lake"],
dataplex_zone=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.NewZoneIamBinding(ctx, "binding", &dataplex.ZoneIamBindingArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
DataplexZone: 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.ZoneIamBinding("binding", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
DataplexZone = 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.ZoneIamBinding;
import com.pulumi.gcp.dataplex.ZoneIamBindingArgs;
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 ZoneIamBinding("binding", ZoneIamBindingArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.dataplexZone(example.name())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:dataplex:ZoneIamBinding
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
dataplexZone: ${example.name}
role: roles/viewer
members:
- user:jane@example.com
The ZoneIamBinding resource is authoritative for a specific role: it replaces all members for that role but preserves other roles on the zone. The members property accepts a list of identities (users, service accounts, groups). This approach works well when you manage all members for a role together.
Add a single member to a role
When you need to grant access to one additional user without disturbing existing permissions, you can add a single member to a role incrementally.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.dataplex.ZoneIamMember("member", {
project: example.project,
location: example.location,
lake: example.lake,
dataplexZone: example.name,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.dataplex.ZoneIamMember("member",
project=example["project"],
location=example["location"],
lake=example["lake"],
dataplex_zone=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.NewZoneIamMember(ctx, "member", &dataplex.ZoneIamMemberArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
Lake: pulumi.Any(example.Lake),
DataplexZone: 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.ZoneIamMember("member", new()
{
Project = example.Project,
Location = example.Location,
Lake = example.Lake,
DataplexZone = 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.ZoneIamMember;
import com.pulumi.gcp.dataplex.ZoneIamMemberArgs;
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 ZoneIamMember("member", ZoneIamMemberArgs.builder()
.project(example.project())
.location(example.location())
.lake(example.lake())
.dataplexZone(example.name())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:dataplex:ZoneIamMember
properties:
project: ${example.project}
location: ${example.location}
lake: ${example.lake}
dataplexZone: ${example.name}
role: roles/viewer
member: user:jane@example.com
The ZoneIamMember resource is non-authoritative: it adds one member to a role without affecting other members for that role or other roles on the zone. This approach works well when different teams manage different members for the same role. You can use ZoneIamMember alongside ZoneIamBinding as long as they don’t grant the same role.
Beyond these examples
These snippets focus on specific IAM management approaches: authoritative vs non-authoritative IAM management, and policy-level, role-level, and member-level control. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as Dataplex zones (project, location, lake, zone name). They focus on IAM policy configuration rather than provisioning zones themselves.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition blocks)
- Custom role definitions
- Service account impersonation
- Cross-project or cross-organization access
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 ZoneIamPolicy resource reference for all available configuration options.
Let's manage GCP Dataplex Zone 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
You have three options:
gcp.dataplex.ZoneIamPolicy- Authoritative. Replaces the entire IAM policy for the zone.gcp.dataplex.ZoneIamBinding- Authoritative for a specific role. Grants a role to multiple members while preserving other roles.gcp.dataplex.ZoneIamMember- Non-authoritative. Adds a single member to a role while preserving other members.
gcp.dataplex.ZoneIamPolicy cannot be used with gcp.dataplex.ZoneIamBinding or gcp.dataplex.ZoneIamMember, as they will conflict. However, gcp.dataplex.ZoneIamBinding and gcp.dataplex.ZoneIamMember can be used together only if they don’t grant privileges to the same role.Configuration & Setup
gcp.organizations.getIAMPolicy to generate the policy data, then pass it to the policyData property of gcp.dataplex.ZoneIamPolicy.dataplexZone, lake, location, and project properties cannot be changed after creation.Import & Migration
[projects/my-project|organizations/my-org]/roles/my-custom-role.