The gcp:bigqueryanalyticshub/dataExchangeIamBinding:DataExchangeIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for BigQuery Analytics Hub data exchanges. This guide focuses on two capabilities: granting roles to multiple members and adding individual members incrementally.
IAM bindings control access to existing data exchanges. The DataExchangeIamBinding resource is authoritative for a given role, meaning it replaces all members assigned to that role. The examples are intentionally small. Combine them with your own data exchange resources and identity management.
Grant a role to multiple members at once
Teams managing data exchanges often need to assign the same role to multiple users or service accounts simultaneously, such as giving viewer access to an entire team.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.bigqueryanalyticshub.DataExchangeIamBinding("binding", {
project: dataExchange.project,
location: dataExchange.location,
dataExchangeId: dataExchange.dataExchangeId,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.bigqueryanalyticshub.DataExchangeIamBinding("binding",
project=data_exchange["project"],
location=data_exchange["location"],
data_exchange_id=data_exchange["dataExchangeId"],
role="roles/viewer",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigqueryanalyticshub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := bigqueryanalyticshub.NewDataExchangeIamBinding(ctx, "binding", &bigqueryanalyticshub.DataExchangeIamBindingArgs{
Project: pulumi.Any(dataExchange.Project),
Location: pulumi.Any(dataExchange.Location),
DataExchangeId: pulumi.Any(dataExchange.DataExchangeId),
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.BigQueryAnalyticsHub.DataExchangeIamBinding("binding", new()
{
Project = dataExchange.Project,
Location = dataExchange.Location,
DataExchangeId = dataExchange.DataExchangeId,
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.bigqueryanalyticshub.DataExchangeIamBinding;
import com.pulumi.gcp.bigqueryanalyticshub.DataExchangeIamBindingArgs;
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 DataExchangeIamBinding("binding", DataExchangeIamBindingArgs.builder()
.project(dataExchange.project())
.location(dataExchange.location())
.dataExchangeId(dataExchange.dataExchangeId())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:bigqueryanalyticshub:DataExchangeIamBinding
properties:
project: ${dataExchange.project}
location: ${dataExchange.location}
dataExchangeId: ${dataExchange.dataExchangeId}
role: roles/viewer
members:
- user:jane@example.com
The role property specifies which IAM role to grant. The members array lists all identities that should receive this role. This resource is authoritative for the specified role, so it replaces any existing member list for that role on the data exchange. The dataExchangeId, location, and project properties identify which data exchange to configure.
Add a single member to a role incrementally
When onboarding individual users or service accounts, you can add them one at a time without affecting other members who already have access.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.bigqueryanalyticshub.DataExchangeIamMember("member", {
project: dataExchange.project,
location: dataExchange.location,
dataExchangeId: dataExchange.dataExchangeId,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.bigqueryanalyticshub.DataExchangeIamMember("member",
project=data_exchange["project"],
location=data_exchange["location"],
data_exchange_id=data_exchange["dataExchangeId"],
role="roles/viewer",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigqueryanalyticshub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := bigqueryanalyticshub.NewDataExchangeIamMember(ctx, "member", &bigqueryanalyticshub.DataExchangeIamMemberArgs{
Project: pulumi.Any(dataExchange.Project),
Location: pulumi.Any(dataExchange.Location),
DataExchangeId: pulumi.Any(dataExchange.DataExchangeId),
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.BigQueryAnalyticsHub.DataExchangeIamMember("member", new()
{
Project = dataExchange.Project,
Location = dataExchange.Location,
DataExchangeId = dataExchange.DataExchangeId,
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.bigqueryanalyticshub.DataExchangeIamMember;
import com.pulumi.gcp.bigqueryanalyticshub.DataExchangeIamMemberArgs;
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 DataExchangeIamMember("member", DataExchangeIamMemberArgs.builder()
.project(dataExchange.project())
.location(dataExchange.location())
.dataExchangeId(dataExchange.dataExchangeId())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:bigqueryanalyticshub:DataExchangeIamMember
properties:
project: ${dataExchange.project}
location: ${dataExchange.location}
dataExchangeId: ${dataExchange.dataExchangeId}
role: roles/viewer
member: user:jane@example.com
The member property specifies a single identity to grant the role. Unlike DataExchangeIamBinding, the DataExchangeIamMember resource is non-authoritative, preserving other members already assigned to the role. This approach works well for incremental access grants where you don’t want to manage the complete member list.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control and batch and incremental member assignment. They’re intentionally minimal rather than full access management solutions.
The examples reference pre-existing infrastructure such as BigQuery Analytics Hub data exchanges and IAM roles (predefined or custom). They focus on configuring access bindings rather than provisioning the underlying resources.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Policy-level management (DataExchangeIamPolicy resource)
- Custom role creation and management
- Audit logging and access monitoring
These omissions are intentional: the goal is to illustrate how IAM bindings are wired, not provide drop-in access control modules. See the DataExchangeIamBinding resource reference for all available configuration options.
Let's manage GCP BigQuery Analytics Hub Data Exchange 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 & Conflicts
DataExchangeIamPolicy is authoritative and replaces the entire IAM policy. DataExchangeIamBinding is authoritative for a specific role, replacing all members for that role while preserving other roles. DataExchangeIamMember is non-authoritative and adds a single member to a role without affecting other members.DataExchangeIamPolicy cannot be used with DataExchangeIamBinding or DataExchangeIamMember because they will conflict over policy control.DataExchangeIamPolicy to manage the complete policy authoritatively. Use DataExchangeIamBinding to manage all members for a specific role. Use DataExchangeIamMember to add individual members without affecting existing ones.IAM Configuration
DataExchangeIamBinding with the members array containing multiple identities, such as ["user:jane@example.com", "user:john@example.com"].allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, and federated identities like principal://iam.googleapis.com/....[projects|organizations]/{parent-name}/roles/{role-name}, such as projects/my-project/roles/customRole.