The gcp:dataproc/metastoreTableIamBinding:MetastoreTableIamBinding resource, part of the Pulumi GCP provider, manages IAM permissions for Dataproc Metastore tables by granting roles to members. This guide focuses on three capabilities: granting roles to multiple members, adding individual members incrementally, and replacing complete IAM policies.
IAM resources for Metastore tables come in three variants: Policy (authoritative, replaces all bindings), Binding (authoritative for one role, preserves other roles), and Member (non-authoritative, adds one member to a role). The Policy resource cannot be used alongside Binding or Member resources for the same table. The examples are intentionally small. Combine them with your own Metastore infrastructure and identity management.
Grant a role to multiple members at once
When onboarding teams or granting access to analyst groups, you often need to assign the same role to multiple identities simultaneously.
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 Binding resource is authoritative for the specified role. It grants the role to all members in the list, replacing any previous member list for that role. Other roles on the table remain unchanged. The members array accepts user emails, service accounts, groups, and special identifiers like allAuthenticatedUsers.
Add a single member to a role incrementally
To grant access to individual users without affecting existing permissions, use the non-authoritative Member resource.
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 Member resource adds one identity to a role without replacing existing members. Multiple Member resources can target the same role, each adding a different identity. This approach works well for incremental access grants where you don’t want to manage the complete member list in one place.
Replace the entire IAM policy with a complete definition
Organizations with strict access control sometimes need to define the complete IAM policy, replacing all 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 Policy resource is fully authoritative. It replaces the entire IAM policy with the bindings defined in policyData. The getIAMPolicy data source constructs the policy document from role-to-members mappings. This resource cannot coexist with Binding or Member resources on the same table; they will conflict over policy ownership.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control (binding vs member) and complete policy replacement. They’re intentionally minimal rather than full access control solutions.
The examples reference pre-existing infrastructure such as Dataproc Metastore services, databases, and tables. They focus on configuring IAM permissions rather than provisioning the Metastore resources themselves.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Custom role definitions
- Federated identity configuration
- Resource compatibility constraints (Policy vs Binding/Member)
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 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 FREEFrequently Asked Questions
Resource Selection & Conflicts
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 while preserving other members for that role.MetastoreTableIamPolicy cannot be used with MetastoreTableIamBinding or MetastoreTableIamMember as they will conflict over the policy configuration.MetastoreTableIamPolicy for complete policy control, MetastoreTableIamBinding to manage all members for a specific role, or MetastoreTableIamMember to add individual members without affecting others.Configuration & Identity Management
[projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/customRole.allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, and federated identities using principal identifiers.databaseId, location, serviceId, table, project, role, and condition properties are all immutable and cannot be changed after resource creation.Import & Operations
projects/{{project}}/locations/{{location}}/services/{{serviceId}}/databases/{{databaseId}}/tables/{{table}} or shorter forms like {{location}}/{{serviceId}}/{{databaseId}}/{{name}} or just {{name}}.