Manage GCP Dataproc Autoscaling Policy IAM Access

The gcp:dataproc/autoscalingPolicyIamMember:AutoscalingPolicyIamMember resource, part of the Pulumi GCP provider, manages IAM permissions for Dataproc autoscaling policies. This resource is one of three IAM management options, each serving different use cases. This guide focuses on three approaches: single-member grants, role-based bindings, and authoritative policy replacement.

These resources 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 strategy.

Grant a single user access to an autoscaling policy

When you need to add one user or service account to a policy without affecting other permissions, use AutoscalingPolicyIamMember for incremental access control.

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 member property specifies the identity receiving access, using formats like “user:jane@example.com” or “serviceAccount:app@project.iam.gserviceaccount.com”. The role property defines the permission level. This resource is non-authoritative: it adds the member to the role without removing other members who already have that role.

Grant a role to multiple members at once

When multiple identities need the same access level, binding them to a single role ensures consistent permissions.

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 members property accepts a list of identities that will all receive the specified role. AutoscalingPolicyIamBinding is authoritative for the given role: it replaces all members for that role but preserves other roles on the policy. If you later add a fourth member to this binding, the first three remain; if you remove this binding, all members lose the role.

Replace the entire IAM policy for a policy

Organizations managing IAM centrally sometimes need to set the complete policy document, 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.AutoscalingPolicyIamPolicy("policy", {
    project: basic.project,
    location: basic.location,
    policyId: basic.policyId,
    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.AutoscalingPolicyIamPolicy("policy",
    project=basic["project"],
    location=basic["location"],
    policy_id=basic["policyId"],
    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.NewAutoscalingPolicyIamPolicy(ctx, "policy", &dataproc.AutoscalingPolicyIamPolicyArgs{
			Project:    pulumi.Any(basic.Project),
			Location:   pulumi.Any(basic.Location),
			PolicyId:   pulumi.Any(basic.PolicyId),
			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.AutoscalingPolicyIamPolicy("policy", new()
    {
        Project = basic.Project,
        Location = basic.Location,
        PolicyId = basic.PolicyId,
        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.AutoscalingPolicyIamPolicy;
import com.pulumi.gcp.dataproc.AutoscalingPolicyIamPolicyArgs;
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 AutoscalingPolicyIamPolicy("policy", AutoscalingPolicyIamPolicyArgs.builder()
            .project(basic.project())
            .location(basic.location())
            .policyId(basic.policyId())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:dataproc:AutoscalingPolicyIamPolicy
    properties:
      project: ${basic.project}
      location: ${basic.location}
      policyId: ${basic.policyId}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

The policyData property accepts a complete IAM policy document, typically retrieved from getIAMPolicy. AutoscalingPolicyIamPolicy is fully authoritative: it replaces every IAM binding on the autoscaling policy. This resource cannot coexist with AutoscalingPolicyIamBinding or AutoscalingPolicyIamMember for the same policy, as they would conflict over the policy state.

Beyond these examples

These snippets focus on specific IAM management patterns: incremental permission grants, role-based binding, and authoritative policy replacement. They’re intentionally minimal rather than complete access control configurations.

The examples reference pre-existing infrastructure such as Dataproc autoscaling policies (by policyId) and GCP project and location configuration. They focus on IAM binding mechanics rather than policy creation or identity provisioning.

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

  • Conditional IAM bindings (condition property)
  • Custom role definitions
  • Federated identity configuration
  • Policy retrieval via data sources

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 AutoscalingPolicyIamMember resource reference for all available configuration options.

Let's manage GCP Dataproc Autoscaling Policy 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 AutoscalingPolicyIamPolicy, AutoscalingPolicyIamBinding, and AutoscalingPolicyIamMember?
AutoscalingPolicyIamPolicy is fully authoritative and replaces the entire IAM policy. AutoscalingPolicyIamBinding is authoritative for a specific role, replacing all members for that role while preserving other roles. AutoscalingPolicyIamMember is non-authoritative and adds a single member to a role without affecting other members.
Can I use AutoscalingPolicyIamPolicy together with AutoscalingPolicyIamBinding or AutoscalingPolicyIamMember?
No, AutoscalingPolicyIamPolicy cannot be used with AutoscalingPolicyIamBinding or AutoscalingPolicyIamMember because they will conflict over the policy configuration.
Can I use AutoscalingPolicyIamBinding and AutoscalingPolicyIamMember together?
Yes, but only if they don’t grant privileges to the same role. If both resources target the same role, they will conflict.
IAM Configuration
What identity formats are supported for the member parameter?
The member parameter supports multiple formats: allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:projectid, projectEditor:projectid, projectViewer:projectid, and federated identities like principal://iam.googleapis.com/locations/global/workforcePools/example-contractors/subject/joe@example.com.
What format do custom roles need to use?
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's the default location for autoscaling policies?
The default location is global. If not specified, the value is parsed from the parent resource identifier or taken from the provider configuration.
Can I change the member, role, or location after creating the resource?
No, the member, role, location, policyId, and project properties are all immutable and cannot be changed after creation.
Import & Migration
How do I import an existing IAM member binding?
Use space-delimited identifiers with the resource path, role, and member identity: pulumi import gcp:dataproc/autoscalingPolicyIamMember:AutoscalingPolicyIamMember editor "projects/{{project}}/locations/{{location}}/autoscalingPolicies/{{policy_id}} roles/viewer user:jane@example.com". The resource identifier can use shortened forms like {{location}}/{{policy_id}} or just {{policy_id}}.

Using a different cloud?

Explore security guides for other cloud providers: