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 three capabilities: non-authoritative member addition, role-level binding management, and complete policy replacement.

Dataproc Metastore table IAM resources reference existing Metastore services, databases, and tables. The examples are intentionally small. Combine them with your own Metastore infrastructure and organizational IAM policies.

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 between roles and members. This approach gives you complete control but overwrites any permissions not explicitly listed. MetastoreTableIamPolicy 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 several users or service accounts simultaneously, such as giving viewer access to an analytics team.

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 specific role: it sets the complete list of members for that role while preserving other roles in the policy. The members array accepts user accounts, service accounts, groups, and special identifiers like allUsers. You can use multiple MetastoreTableIamBinding resources for different roles, but only one binding per role.

Add a single member to a role incrementally

When onboarding individual users or service accounts, you can add them to existing roles without affecting other members who already have access.

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 a role without modifying other members. This is the safest option when multiple teams manage access independently. The member property accepts the same identity formats as MetastoreTableIamBinding (users, service accounts, groups, domains). You can combine MetastoreTableIamMember with MetastoreTableIamBinding as long as they don’t grant the same role.

Beyond these examples

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

The examples reference pre-existing infrastructure such as Dataproc Metastore service (serviceId), and Metastore database and table (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
  • Project-level role shortcuts (projectOwner, projectEditor, projectViewer)

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
Can I use MetastoreTableIamPolicy with IamBinding or IamMember resources?
No, gcp.dataproc.MetastoreTableIamPolicy cannot be used with gcp.dataproc.MetastoreTableIamBinding or gcp.dataproc.MetastoreTableIamMember because they’ll conflict over policy management. Use MetastoreTableIamPolicy alone for full control, or use IamBinding/IamMember together (ensuring they don’t grant the same role).
What's the difference between IamPolicy, IamBinding, and IamMember?
MetastoreTableIamPolicy is authoritative and replaces the entire IAM policy. MetastoreTableIamBinding is authoritative per role, replacing all members for that specific role while preserving other roles. MetastoreTableIamMember is non-authoritative, adding a single member to a role without affecting existing members.
Configuration & Identity Management
What identity formats can I use for the member parameter?
The member parameter supports: allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, and federated identities like principal://iam.googleapis.com/locations/global/workforcePools/....
How do I specify custom IAM roles?
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.
Can I modify IAM bindings after creation?
No, all input properties (databaseId, location, member, project, role, serviceId, table, condition) are immutable. You must recreate the resource to change any of these values.

Using a different cloud?

Explore security guides for other cloud providers: