The gcp:dataplex/datascanIamMember:DatascanIamMember resource, part of the Pulumi GCP provider, manages IAM access grants for Dataplex datascans by adding individual members to roles without affecting other access grants. This guide focuses on three approaches: adding individual members, managing complete member lists per role, and replacing entire IAM policies.
Dataplex provides three IAM resources for datascan access control. DatascanIamMember adds one identity to one role (non-authoritative). DatascanIamBinding manages all members for one role (authoritative for that role). DatascanIamPolicy replaces the entire policy (fully authoritative). These resources cannot be mixed without causing conflicts. The examples are intentionally small. Combine them with your own datascan infrastructure and identity management.
Grant a single user access to a datascan
Most IAM configurations start by granting individual users or service accounts access to specific resources without affecting existing grants.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.dataplex.DatascanIamMember("member", {
project: basicProfile.project,
location: basicProfile.location,
dataScanId: basicProfile.dataScanId,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.dataplex.DatascanIamMember("member",
project=basic_profile["project"],
location=basic_profile["location"],
data_scan_id=basic_profile["dataScanId"],
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.NewDatascanIamMember(ctx, "member", &dataplex.DatascanIamMemberArgs{
Project: pulumi.Any(basicProfile.Project),
Location: pulumi.Any(basicProfile.Location),
DataScanId: pulumi.Any(basicProfile.DataScanId),
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.DatascanIamMember("member", new()
{
Project = basicProfile.Project,
Location = basicProfile.Location,
DataScanId = basicProfile.DataScanId,
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.DatascanIamMember;
import com.pulumi.gcp.dataplex.DatascanIamMemberArgs;
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 DatascanIamMember("member", DatascanIamMemberArgs.builder()
.project(basicProfile.project())
.location(basicProfile.location())
.dataScanId(basicProfile.dataScanId())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:dataplex:DatascanIamMember
properties:
project: ${basicProfile.project}
location: ${basicProfile.location}
dataScanId: ${basicProfile.dataScanId}
role: roles/viewer
member: user:jane@example.com
The member property specifies one identity using formats like “user:jane@example.com” or “serviceAccount:app@project.iam.gserviceaccount.com”. The role property sets the permission level. DatascanIamMember is non-authoritative: it adds this one member to the role without removing other members or affecting other roles on the datascan.
Grant multiple users the same role
When teams need to grant the same role to multiple identities at once, DatascanIamBinding manages the complete member list for that role.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.dataplex.DatascanIamBinding("binding", {
project: basicProfile.project,
location: basicProfile.location,
dataScanId: basicProfile.dataScanId,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.dataplex.DatascanIamBinding("binding",
project=basic_profile["project"],
location=basic_profile["location"],
data_scan_id=basic_profile["dataScanId"],
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.NewDatascanIamBinding(ctx, "binding", &dataplex.DatascanIamBindingArgs{
Project: pulumi.Any(basicProfile.Project),
Location: pulumi.Any(basicProfile.Location),
DataScanId: pulumi.Any(basicProfile.DataScanId),
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.DatascanIamBinding("binding", new()
{
Project = basicProfile.Project,
Location = basicProfile.Location,
DataScanId = basicProfile.DataScanId,
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.DatascanIamBinding;
import com.pulumi.gcp.dataplex.DatascanIamBindingArgs;
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 DatascanIamBinding("binding", DatascanIamBindingArgs.builder()
.project(basicProfile.project())
.location(basicProfile.location())
.dataScanId(basicProfile.dataScanId())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:dataplex:DatascanIamBinding
properties:
project: ${basicProfile.project}
location: ${basicProfile.location}
dataScanId: ${basicProfile.dataScanId}
role: roles/viewer
members:
- user:jane@example.com
The members property takes a list of identities that should have this role. DatascanIamBinding is authoritative for the specified role: it sets exactly which members have that role, removing any members not in the list. Other roles on the datascan remain unchanged. This extends the single-member pattern when you need to control all viewers, editors, or other role holders together.
Replace the entire IAM policy with a custom definition
Organizations with complex access requirements sometimes need to define the complete IAM policy from scratch.
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.DatascanIamPolicy("policy", {
project: basicProfile.project,
location: basicProfile.location,
dataScanId: basicProfile.dataScanId,
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.DatascanIamPolicy("policy",
project=basic_profile["project"],
location=basic_profile["location"],
data_scan_id=basic_profile["dataScanId"],
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.NewDatascanIamPolicy(ctx, "policy", &dataplex.DatascanIamPolicyArgs{
Project: pulumi.Any(basicProfile.Project),
Location: pulumi.Any(basicProfile.Location),
DataScanId: pulumi.Any(basicProfile.DataScanId),
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.DatascanIamPolicy("policy", new()
{
Project = basicProfile.Project,
Location = basicProfile.Location,
DataScanId = basicProfile.DataScanId,
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.DatascanIamPolicy;
import com.pulumi.gcp.dataplex.DatascanIamPolicyArgs;
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 DatascanIamPolicy("policy", DatascanIamPolicyArgs.builder()
.project(basicProfile.project())
.location(basicProfile.location())
.dataScanId(basicProfile.dataScanId())
.policyData(admin.policyData())
.build());
}
}
resources:
policy:
type: gcp:dataplex:DatascanIamPolicy
properties:
project: ${basicProfile.project}
location: ${basicProfile.location}
dataScanId: ${basicProfile.dataScanId}
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
function: gcp:organizations:getIAMPolicy
arguments:
bindings:
- role: roles/viewer
members:
- user:jane@example.com
The policyData property accepts a complete IAM policy document, typically retrieved from getIAMPolicy. DatascanIamPolicy is fully authoritative: it replaces the entire IAM policy for the datascan, removing any grants not defined in the policy document. This resource cannot be used alongside DatascanIamBinding or DatascanIamMember because they will conflict over policy ownership.
Beyond these examples
These snippets focus on specific IAM management approaches: incremental member grants, role-level binding management, and authoritative policy replacement. They’re intentionally minimal rather than full access control systems.
The examples reference pre-existing infrastructure such as Dataplex datascans (by dataScanId) and GCP project and location configuration. They focus on configuring IAM access rather than provisioning the datascans themselves.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Custom role definitions
- Service account creation and management
- Datascan resource provisioning
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 Datascan IAM Member resource reference for all available configuration options.
Let's manage GCP Dataplex Datascan IAM Access
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
DatascanIamPolicy is authoritative and replaces the entire IAM policy. DatascanIamBinding is authoritative for a specific role, preserving other roles. DatascanIamMember is non-authoritative, adding a single member to a role while preserving other members.DatascanIamPolicy cannot be used with DatascanIamBinding or DatascanIamMember because they will conflict over the policy configuration.Configuration & Identity Formats
allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, or federated identities like principal://iam.googleapis.com/....[projects|organizations]/{parent-name}/roles/{role-name}. For example, projects/my-project/roles/my-custom-role.Import & Resource Identification
projects/{{project}}/locations/{{location}}/dataScans/{{data_scan_id}}, {{project}}/{{location}}/{{data_scan_id}}, {{location}}/{{data_scan_id}}, or just {{data_scan_id}}. Missing variables are taken from the provider configuration.