The gcp:dataproc/autoscalingPolicyIamBinding:AutoscalingPolicyIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Dataproc autoscaling policies. This guide focuses on two capabilities: granting roles to multiple members and adding individual members to roles.
IAM bindings reference existing autoscaling policies and require project and location context. The examples are intentionally small. Combine them with your own policy definitions and identity management.
Grant a role to multiple members at once
Teams managing autoscaling policies often need to grant the same role to multiple users or service accounts simultaneously, such as when onboarding a team or granting viewer access to analysts.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.dataproc.AutoscalingPolicyIamBinding("binding", {
project: basic.project,
location: basic.location,
policyId: basic.policyId,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.dataproc.AutoscalingPolicyIamBinding("binding",
project=basic["project"],
location=basic["location"],
policy_id=basic["policyId"],
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.NewAutoscalingPolicyIamBinding(ctx, "binding", &dataproc.AutoscalingPolicyIamBindingArgs{
Project: pulumi.Any(basic.Project),
Location: pulumi.Any(basic.Location),
PolicyId: pulumi.Any(basic.PolicyId),
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.AutoscalingPolicyIamBinding("binding", new()
{
Project = basic.Project,
Location = basic.Location,
PolicyId = basic.PolicyId,
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.AutoscalingPolicyIamBinding;
import com.pulumi.gcp.dataproc.AutoscalingPolicyIamBindingArgs;
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 AutoscalingPolicyIamBinding("binding", AutoscalingPolicyIamBindingArgs.builder()
.project(basic.project())
.location(basic.location())
.policyId(basic.policyId())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:dataproc:AutoscalingPolicyIamBinding
properties:
project: ${basic.project}
location: ${basic.location}
policyId: ${basic.policyId}
role: roles/viewer
members:
- user:jane@example.com
The AutoscalingPolicyIamBinding resource is authoritative for the specified role. The members array lists all identities that should have this role; any existing members not in the list are removed. The role property specifies which permission set to grant, and policyId identifies the target autoscaling policy. This approach works well when you manage all members for a role together.
Add a single member to a role incrementally
When granting access to individual users without affecting existing permissions, use member-level grants that preserve other members already assigned to the role.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.dataproc.AutoscalingPolicyIamMember("member", {
project: basic.project,
location: basic.location,
policyId: basic.policyId,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.dataproc.AutoscalingPolicyIamMember("member",
project=basic["project"],
location=basic["location"],
policy_id=basic["policyId"],
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.NewAutoscalingPolicyIamMember(ctx, "member", &dataproc.AutoscalingPolicyIamMemberArgs{
Project: pulumi.Any(basic.Project),
Location: pulumi.Any(basic.Location),
PolicyId: pulumi.Any(basic.PolicyId),
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.AutoscalingPolicyIamMember("member", new()
{
Project = basic.Project,
Location = basic.Location,
PolicyId = basic.PolicyId,
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.AutoscalingPolicyIamMember;
import com.pulumi.gcp.dataproc.AutoscalingPolicyIamMemberArgs;
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 AutoscalingPolicyIamMember("member", AutoscalingPolicyIamMemberArgs.builder()
.project(basic.project())
.location(basic.location())
.policyId(basic.policyId())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:dataproc:AutoscalingPolicyIamMember
properties:
project: ${basic.project}
location: ${basic.location}
policyId: ${basic.policyId}
role: roles/viewer
member: user:jane@example.com
The AutoscalingPolicyIamMember resource is non-authoritative. It adds one member to a role without replacing existing members. Use this when you need to grant access incrementally or when multiple teams manage permissions independently. The member property takes a single identity string, while the role and policyId properties work the same as in bindings.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control and binding vs member grant patterns. They’re intentionally minimal rather than full access management solutions.
The examples reference pre-existing infrastructure such as Dataproc autoscaling policies (by policyId) and GCP project and location configuration. They focus on configuring IAM bindings rather than creating the underlying policies.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Full policy replacement (AutoscalingPolicyIamPolicy 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 AutoscalingPolicyIamBinding resource reference for all available configuration options.
Let's manage GCP Dataproc Autoscaling Policy 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
AutoscalingPolicyIamPolicy cannot be used with AutoscalingPolicyIamBinding or AutoscalingPolicyIamMember, as they will conflict. However, AutoscalingPolicyIamBinding and AutoscalingPolicyIamMember can be used together only if they don’t manage the same role.AutoscalingPolicyIamPolicy is fully authoritative and replaces the entire IAM policy. AutoscalingPolicyIamBinding is authoritative for a specific role, preserving other roles. AutoscalingPolicyIamMember is non-authoritative, adding a single member while preserving other members for that role.IAM Configuration
members array supports: allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, and federated identities like principal://iam.googleapis.com/....[projects|organizations]/{parent-name}/roles/{role-name} for the role parameter. For example, projects/my-project/roles/my-custom-role.Resource Properties
location is global. If not specified, it’s parsed from the parent resource identifier or taken from the provider configuration.location, policyId, project, role, and condition properties are all immutable and cannot be changed after resource creation.