Manage GCP Dataproc Metastore Table IAM Access

The gcp:dataproc/metastoreTableIamMember:MetastoreTableIamMember resource, part of the Pulumi GCP provider, manages IAM permissions for Dataproc Metastore tables by adding individual members to roles without affecting existing permissions. This guide focuses on two capabilities: the three IAM management approaches (Policy, Binding, Member) and how they differ in authoritativeness.

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

Replace the entire IAM policy for a table

When you need complete control over table 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.dataproc.MetastoreTableIamPolicy("policy", {
    project: dpmsService.project,
    location: dpmsService.location,
    serviceId: dpmsService.serviceId,
    databaseId: hive.hiveConfig[0].properties.database,
    table: hive.hiveConfig[0].properties.table,
    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.dataproc.MetastoreTableIamPolicy("policy",
    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"],
    policy_data=admin.policy_data)
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/dataproc"
	"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 = dataproc.NewMetastoreTableIamPolicy(ctx, "policy", &dataproc.MetastoreTableIamPolicyArgs{
			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),
			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.Dataproc.MetastoreTableIamPolicy("policy", new()
    {
        Project = dpmsService.Project,
        Location = dpmsService.Location,
        ServiceId = dpmsService.ServiceId,
        DatabaseId = hive.HiveConfig[0].Properties.Database,
        Table = hive.HiveConfig[0].Properties.Table,
        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.dataproc.MetastoreTableIamPolicy;
import com.pulumi.gcp.dataproc.MetastoreTableIamPolicyArgs;
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 MetastoreTableIamPolicy("policy", MetastoreTableIamPolicyArgs.builder()
            .project(dpmsService.project())
            .location(dpmsService.location())
            .serviceId(dpmsService.serviceId())
            .databaseId(hive.hiveConfig()[0].properties().database())
            .table(hive.hiveConfig()[0].properties().table())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:dataproc:MetastoreTableIamPolicy
    properties:
      project: ${dpmsService.project}
      location: ${dpmsService.location}
      serviceId: ${dpmsService.serviceId}
      databaseId: ${hive.hiveConfig[0].properties.database}
      table: ${hive.hiveConfig[0].properties.table}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

The MetastoreTableIamPolicy resource is authoritative: it replaces the entire IAM policy for the table. The policyData comes from getIAMPolicy, which defines bindings (role-to-members mappings). This approach gives you complete control but can accidentally remove permissions if you’re not careful. The resource cannot be used alongside MetastoreTableIamBinding or MetastoreTableIamMember, as they would conflict over policy ownership.

Grant a role to multiple members at once

Teams often need to grant the same role to multiple users without affecting other roles already assigned to the table.

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

The MetastoreTableIamBinding resource is authoritative for a single role: it sets the complete list of members for that role while preserving other roles on the table. The members property accepts a list of identities (users, service accounts, groups). This is safer than Policy because it only controls one role, but it still replaces all members for that role. You can use multiple Binding resources for different roles, and you can combine Binding with Member resources as long as they don’t target the same role.

Add a single member to a role incrementally

When you need to grant access to one additional user without disturbing existing permissions, you can add individual members to roles.

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 is non-authoritative: it adds one member to one role without affecting other members or roles. This is the safest approach for incremental changes because it preserves all existing permissions. The member property accepts a single identity in formats like “user:jane@example.com”, “serviceAccount:app@project.iam.gserviceaccount.com”, or “group:admins@example.com”. You can use multiple Member resources together, and you can combine them with Binding resources as long as they don’t grant the same role.

Beyond these examples

These snippets focus on specific IAM management features: authoritative vs non-authoritative IAM management, and the three resource types (Policy, Binding, Member). They’re intentionally minimal rather than full access control configurations.

The examples reference pre-existing infrastructure such as Dataproc Metastore services (serviceId), and Metastore databases and tables (databaseId, table). They focus on configuring IAM permissions rather than provisioning the Metastore infrastructure itself.

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

  • Conditional IAM bindings (condition property)
  • Custom role definitions
  • Federated identity principals
  • Resource conflict prevention strategies

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 Dataproc Metastore Table IAM Member resource reference for all available configuration options.

Let's manage GCP Dataproc Metastore Table IAM Access

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 MetastoreTableIamPolicy, IamBinding, and IamMember?
MetastoreTableIamPolicy is authoritative and replaces the entire IAM policy. MetastoreTableIamBinding is authoritative for a specific role, preserving other roles. MetastoreTableIamMember is non-authoritative, adding a single member to a role while preserving other members.
Can I use MetastoreTableIamPolicy with IamBinding or IamMember?
No, MetastoreTableIamPolicy cannot be used with MetastoreTableIamBinding or MetastoreTableIamMember as they will conflict over policy management.
Can I use MetastoreTableIamBinding and IamMember together?
Yes, but only if they grant different roles. Using both for the same role causes conflicts.
Configuration & Member Formats
What member identity formats are supported?
Supported formats include allUsers, allAuthenticatedUsers, user:{emailid}, serviceAccount:{emailid}, group:{emailid}, domain:{domain}, projectOwner:projectid, projectEditor:projectid, projectViewer:projectid, and federated identities (e.g., principal://iam.googleapis.com/...).
How do I specify custom roles?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name} (e.g., projects/my-project/roles/my-custom-role).
What properties can't I change after creation?
All properties are immutable: databaseId, location, member, project, role, serviceId, table, and condition. Changes require resource replacement.
Import & Management
How do I import an existing IAM member binding?
Use space-delimited syntax with resource identifier, role, and member: pulumi import gcp:dataproc/metastoreTableIamMember:MetastoreTableIamMember editor "projects/{{project}}/locations/{{location}}/services/{{serviceId}}/databases/{{databaseId}}/tables/{{table}} roles/viewer user:jane@example.com".

Using a different cloud?

Explore security guides for other cloud providers: