Manage GCP BigQuery Analytics Hub Data Exchange IAM

The gcp:bigqueryanalyticshub/dataExchangeIamMember:DataExchangeIamMember resource, part of the Pulumi GCP provider, grants IAM permissions on BigQuery Analytics Hub data exchanges. Three related resources provide different authoritativeness levels: DataExchangeIamMember (non-authoritative), DataExchangeIamBinding (authoritative per role), and DataExchangeIamPolicy (authoritative for entire policy). This guide focuses on three capabilities: non-authoritative member grants, authoritative role bindings, and complete policy replacement.

These resources reference existing data exchanges and require project, location, and data exchange ID. The examples are intentionally small. Combine them with your own data exchange infrastructure and access control requirements.

Grant a role to a single member non-authoritatively

When managing shared data exchanges, you often need to grant access to individual users or service accounts without affecting others who already have the same role.

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 access. This resource is non-authoritative: it adds one member to the role without removing existing members. Multiple DataExchangeIamMember resources can grant the same role to different members without conflict.

Define all members for a role authoritatively

When you need complete control over who has a specific role, binding resources replace the entire member list for that role.

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 members property takes a list of identities. This resource is authoritative for the specified role: it replaces all members for that role while preserving other roles in the policy. You can use multiple DataExchangeIamBinding resources for different roles, but only one binding per role.

Replace the entire IAM policy authoritatively

Organizations with strict access control sometimes need to define the complete IAM policy, replacing any existing bindings.

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.bigqueryanalyticshub.DataExchangeIamPolicy("policy", {
    project: dataExchange.project,
    location: dataExchange.location,
    dataExchangeId: dataExchange.dataExchangeId,
    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.bigqueryanalyticshub.DataExchangeIamPolicy("policy",
    project=data_exchange["project"],
    location=data_exchange["location"],
    data_exchange_id=data_exchange["dataExchangeId"],
    policy_data=admin.policy_data)
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigqueryanalyticshub"
	"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 = bigqueryanalyticshub.NewDataExchangeIamPolicy(ctx, "policy", &bigqueryanalyticshub.DataExchangeIamPolicyArgs{
			Project:        pulumi.Any(dataExchange.Project),
			Location:       pulumi.Any(dataExchange.Location),
			DataExchangeId: pulumi.Any(dataExchange.DataExchangeId),
			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.BigQueryAnalyticsHub.DataExchangeIamPolicy("policy", new()
    {
        Project = dataExchange.Project,
        Location = dataExchange.Location,
        DataExchangeId = dataExchange.DataExchangeId,
        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.bigqueryanalyticshub.DataExchangeIamPolicy;
import com.pulumi.gcp.bigqueryanalyticshub.DataExchangeIamPolicyArgs;
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 DataExchangeIamPolicy("policy", DataExchangeIamPolicyArgs.builder()
            .project(dataExchange.project())
            .location(dataExchange.location())
            .dataExchangeId(dataExchange.dataExchangeId())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:bigqueryanalyticshub:DataExchangeIamPolicy
    properties:
      project: ${dataExchange.project}
      location: ${dataExchange.location}
      dataExchangeId: ${dataExchange.dataExchangeId}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

The policyData property comes from the getIAMPolicy data source, which defines all roles and members. This resource is fully authoritative: it replaces the entire IAM policy. DataExchangeIamPolicy cannot be used with DataExchangeIamBinding or DataExchangeIamMember resources, as they will conflict over policy state.

Beyond these examples

These snippets focus on specific IAM management features: non-authoritative member grants, authoritative role bindings, and complete policy replacement. They’re intentionally minimal rather than full access control solutions.

The examples reference pre-existing infrastructure such as BigQuery Analytics Hub data exchanges. They focus on configuring IAM permissions rather than provisioning the data exchanges themselves.

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

  • Conditional IAM bindings (condition property)
  • Custom role definitions
  • Service account creation
  • Data exchange 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 DataExchangeIamMember resource reference for all available configuration options.

Let's manage GCP BigQuery Analytics Hub Data Exchange IAM

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
What's the difference between DataExchangeIamPolicy, DataExchangeIamBinding, and DataExchangeIamMember?
DataExchangeIamPolicy is authoritative and replaces the entire IAM policy. DataExchangeIamBinding is authoritative for a given role, managing all members for that role while preserving other roles. DataExchangeIamMember is non-authoritative, adding a single member to a role without affecting other members.
Can I use DataExchangeIamPolicy with DataExchangeIamBinding or DataExchangeIamMember?
No, DataExchangeIamPolicy cannot be used with DataExchangeIamBinding or DataExchangeIamMember as they will conflict over policy management.
Can I use DataExchangeIamBinding and DataExchangeIamMember together?
Yes, but only if they don’t grant privileges to the same role. Each role must be managed by either Binding or Member, not both.
Identity & Role Configuration
What member identity formats are supported?
Supported formats include allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, and federated identities like principal://iam.googleapis.com/....
How do I specify a custom role?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role.
Can I change the member, role, or dataExchangeId after creation?
No, all key properties (member, role, dataExchangeId, location, project, condition) are immutable and require resource replacement if changed.
Import & Migration
How do I import an existing IAM member binding?
Use space-delimited format with resource identifier, role, and member: pulumi import gcp:bigqueryanalyticshub/dataExchangeIamMember:DataExchangeIamMember editor "projects/{{project}}/locations/{{location}}/dataExchanges/{{data_exchange_id}} roles/viewer user:jane@example.com"

Using a different cloud?

Explore security guides for other cloud providers: