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 by granting roles to individual members, groups of members, or replacing the entire policy. This guide focuses on three capabilities: adding individual members to policies, binding multiple members to a single role, and replacing complete IAM policies.

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.

Grant a single user access to an autoscaling policy

Teams often need to grant individual users or service accounts access to specific autoscaling policies without affecting other permissions.

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 adds one member to a role without replacing existing members. The member property accepts various identity formats: user emails, service accounts, groups, domains, or federated identities. This resource is non-authoritative, meaning it preserves other members already assigned to the role.

Grant a role to multiple members at once

When multiple users or service accounts need the same level of access, 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 AutoscalingPolicyIamBinding resource assigns a role to a list of members, replacing any previous members for that specific role. Other roles on the policy remain unchanged. The members property takes an array of identity strings. This resource is authoritative for the specified role but non-authoritative for the policy as a whole.

Replace the entire IAM policy for a policy

Organizations with strict access control requirements sometimes need to define the complete IAM policy, 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.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 AutoscalingPolicyIamPolicy resource sets all roles and members in one authoritative declaration. The policyData property comes from the getIAMPolicy data source, which defines bindings between roles and members. This resource replaces the entire policy and cannot be used alongside AutoscalingPolicyIamBinding or AutoscalingPolicyIamMember resources, as they would conflict over policy state.

Beyond these examples

These snippets focus on specific IAM management approaches: incremental member grants, role-level binding management, and full policy replacement. They’re intentionally minimal rather than complete access control configurations.

The examples reference pre-existing infrastructure such as Dataproc autoscaling policies (referenced by policyId) and GCP project and location configuration. They focus on IAM binding configuration rather than provisioning the policies themselves.

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

  • Conditional IAM bindings (condition property)
  • Custom role definitions and formatting
  • Service account and group identity management
  • Cross-project and federated identity grants

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 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 authoritative and replaces the entire IAM policy. AutoscalingPolicyIamBinding is authoritative for a given 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 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 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 like principal://iam.googleapis.com/locations/global/workforcePools/example-contractors/subject/joe@example.com.
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.
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.
Resource Management
What properties can't be changed after creating an AutoscalingPolicyIamMember?
All properties are immutable: location, member, policyId, project, role, and condition. You must recreate the resource to change any of these values.
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".

Using a different cloud?

Explore security guides for other cloud providers: