Manage GCP Dataproc Metastore Table IAM Bindings

The gcp:dataproc/metastoreTableIamBinding:MetastoreTableIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Dataproc Metastore tables, controlling which identities can access table metadata. This guide focuses on two capabilities: authoritative role binding that replaces all members for a role, and non-authoritative member addition that preserves existing members.

IAM bindings reference existing Metastore services, databases, and tables. The examples are intentionally small. Combine them with your own Metastore infrastructure and identity management strategy.

Grant a role to multiple members at once

Teams managing Metastore tables often need to grant the same role to multiple users or service accounts simultaneously, such as when onboarding a team or granting read access to analysts.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const binding = new gcp.dataproc.MetastoreTableIamBinding("binding", {
    project: dpmsService.project,
    location: dpmsService.location,
    serviceId: dpmsService.serviceId,
    databaseId: hive.hiveConfig[0].properties.database,
    table: hive.hiveConfig[0].properties.table,
    role: "roles/viewer",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.dataproc.MetastoreTableIamBinding("binding",
    project=dpms_service["project"],
    location=dpms_service["location"],
    service_id=dpms_service["serviceId"],
    database_id=hive["hiveConfig"][0]["properties"]["database"],
    table=hive["hiveConfig"][0]["properties"]["table"],
    role="roles/viewer",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/dataproc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := dataproc.NewMetastoreTableIamBinding(ctx, "binding", &dataproc.MetastoreTableIamBindingArgs{
			Project:    pulumi.Any(dpmsService.Project),
			Location:   pulumi.Any(dpmsService.Location),
			ServiceId:  pulumi.Any(dpmsService.ServiceId),
			DatabaseId: pulumi.Any(hive.HiveConfig[0].Properties.Database),
			Table:      pulumi.Any(hive.HiveConfig[0].Properties.Table),
			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.Dataproc.MetastoreTableIamBinding("binding", new()
    {
        Project = dpmsService.Project,
        Location = dpmsService.Location,
        ServiceId = dpmsService.ServiceId,
        DatabaseId = hive.HiveConfig[0].Properties.Database,
        Table = hive.HiveConfig[0].Properties.Table,
        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.dataproc.MetastoreTableIamBinding;
import com.pulumi.gcp.dataproc.MetastoreTableIamBindingArgs;
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 MetastoreTableIamBinding("binding", MetastoreTableIamBindingArgs.builder()
            .project(dpmsService.project())
            .location(dpmsService.location())
            .serviceId(dpmsService.serviceId())
            .databaseId(hive.hiveConfig()[0].properties().database())
            .table(hive.hiveConfig()[0].properties().table())
            .role("roles/viewer")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:dataproc:MetastoreTableIamBinding
    properties:
      project: ${dpmsService.project}
      location: ${dpmsService.location}
      serviceId: ${dpmsService.serviceId}
      databaseId: ${hive.hiveConfig[0].properties.database}
      table: ${hive.hiveConfig[0].properties.table}
      role: roles/viewer
      members:
        - user:jane@example.com

This binding is authoritative for the specified role: it replaces any existing members with the list you provide. The members array accepts various identity formats including user emails, service accounts, groups, and domain-wide grants. The resource references the table through a hierarchy of identifiers: project, location, serviceId, databaseId, and table name.

Add a single member to an existing role

When you need to grant access to one additional user without affecting other members already assigned to the role, the non-authoritative member resource preserves existing access while adding new identities.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.dataproc.MetastoreTableIamMember("member", {
    project: dpmsService.project,
    location: dpmsService.location,
    serviceId: dpmsService.serviceId,
    databaseId: hive.hiveConfig[0].properties.database,
    table: hive.hiveConfig[0].properties.table,
    role: "roles/viewer",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.dataproc.MetastoreTableIamMember("member",
    project=dpms_service["project"],
    location=dpms_service["location"],
    service_id=dpms_service["serviceId"],
    database_id=hive["hiveConfig"][0]["properties"]["database"],
    table=hive["hiveConfig"][0]["properties"]["table"],
    role="roles/viewer",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/dataproc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := dataproc.NewMetastoreTableIamMember(ctx, "member", &dataproc.MetastoreTableIamMemberArgs{
			Project:    pulumi.Any(dpmsService.Project),
			Location:   pulumi.Any(dpmsService.Location),
			ServiceId:  pulumi.Any(dpmsService.ServiceId),
			DatabaseId: pulumi.Any(hive.HiveConfig[0].Properties.Database),
			Table:      pulumi.Any(hive.HiveConfig[0].Properties.Table),
			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.Dataproc.MetastoreTableIamMember("member", new()
    {
        Project = dpmsService.Project,
        Location = dpmsService.Location,
        ServiceId = dpmsService.ServiceId,
        DatabaseId = hive.HiveConfig[0].Properties.Database,
        Table = hive.HiveConfig[0].Properties.Table,
        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.dataproc.MetastoreTableIamMember;
import com.pulumi.gcp.dataproc.MetastoreTableIamMemberArgs;
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 MetastoreTableIamMember("member", MetastoreTableIamMemberArgs.builder()
            .project(dpmsService.project())
            .location(dpmsService.location())
            .serviceId(dpmsService.serviceId())
            .databaseId(hive.hiveConfig()[0].properties().database())
            .table(hive.hiveConfig()[0].properties().table())
            .role("roles/viewer")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:dataproc:MetastoreTableIamMember
    properties:
      project: ${dpmsService.project}
      location: ${dpmsService.location}
      serviceId: ${dpmsService.serviceId}
      databaseId: ${hive.hiveConfig[0].properties.database}
      table: ${hive.hiveConfig[0].properties.table}
      role: roles/viewer
      member: user:jane@example.com

The MetastoreTableIamMember resource adds a single member to a role without replacing existing members. This is non-authoritative: other members for the same role remain unchanged. Use this when you want to incrementally grant access without managing the complete member list. You can combine multiple MetastoreTableIamMember resources for the same role, or mix them with MetastoreTableIamBinding resources for different roles.

Beyond these examples

These snippets focus on specific IAM binding features: role-based access control and authoritative vs non-authoritative member management. They’re intentionally minimal rather than full access control configurations.

The examples reference pre-existing infrastructure such as Dataproc Metastore services, and Metastore databases and tables. They focus on configuring IAM bindings rather than provisioning the Metastore infrastructure itself.

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

  • Conditional IAM bindings (condition property)
  • Policy-level management (MetastoreTableIamPolicy resource)
  • Custom role definitions
  • Federated identity configuration

These omissions are intentional: the goal is to illustrate how each IAM binding approach is wired, not provide drop-in access control modules. See the Dataproc Metastore Table IAM Binding resource reference for all available configuration options.

Let's manage GCP Dataproc Metastore Table IAM Bindings

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 & Compatibility
Can I use multiple IAM resources together for the same table?
gcp.dataproc.MetastoreTableIamPolicy cannot be used with gcp.dataproc.MetastoreTableIamBinding or gcp.dataproc.MetastoreTableIamMember, as they’ll conflict over policy state. However, you can use MetastoreTableIamBinding and MetastoreTableIamMember together if they manage different roles.
Which IAM resource should I use for managing table permissions?

Choose based on your needs:

  • MetastoreTableIamPolicy: Authoritative, replaces the entire IAM policy
  • MetastoreTableIamBinding: Authoritative for a specific role, preserves other roles
  • MetastoreTableIamMember: Non-authoritative, adds individual members without affecting others
IAM Configuration
What format do custom roles require?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}. For example, projects/my-project/roles/my-custom-role or organizations/my-org/roles/my-custom-role.
What member identity formats are supported?
You can use: allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, or federated identities like principal://iam.googleapis.com/....
Import & Migration
How do I import an existing IAM binding?
Use space-delimited identifiers: pulumi import gcp:dataproc/metastoreTableIamBinding:MetastoreTableIamBinding editor "projects/{{project}}/locations/{{location}}/services/{{serviceId}}/databases/{{databaseId}}/tables/{{table}} roles/viewer". The resource identifier can use various formats, with missing values taken from the provider configuration.

Using a different cloud?

Explore security guides for other cloud providers: