Manage GCP GKE Hub Feature IAM Policies

The gcp:gkehub/featureIamPolicy:FeatureIamPolicy resource, part of the Pulumi GCP provider, manages IAM policies for GKE Hub features, controlling who can access and modify feature configurations. This guide focuses on three capabilities: authoritative policy replacement, role-level member binding, and incremental member addition.

GKE Hub features must exist before you can manage their IAM policies. The examples are intentionally small. Combine them with your own feature resources and organizational access patterns.

Replace the entire IAM policy for a feature

When you need complete control over who can access a GKE Hub feature, you can set the entire IAM policy at once.

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.gkehub.FeatureIamPolicy("policy", {
    project: feature.project,
    location: feature.location,
    name: feature.name,
    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.gkehub.FeatureIamPolicy("policy",
    project=feature["project"],
    location=feature["location"],
    name=feature["name"],
    policy_data=admin.policy_data)
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/gkehub"
	"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 = gkehub.NewFeatureIamPolicy(ctx, "policy", &gkehub.FeatureIamPolicyArgs{
			Project:    pulumi.Any(feature.Project),
			Location:   pulumi.Any(feature.Location),
			Name:       pulumi.Any(feature.Name),
			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.GkeHub.FeatureIamPolicy("policy", new()
    {
        Project = feature.Project,
        Location = feature.Location,
        Name = feature.Name,
        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.gkehub.FeatureIamPolicy;
import com.pulumi.gcp.gkehub.FeatureIamPolicyArgs;
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 FeatureIamPolicy("policy", FeatureIamPolicyArgs.builder()
            .project(feature.project())
            .location(feature.location())
            .name(feature.name())
            .policyData(admin.policyData())
            .build());

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

The FeatureIamPolicy resource is authoritative: it replaces any existing IAM policy on the feature. The policyData property accepts output from the getIAMPolicy data source, which defines roles and members. The project, location, and name properties identify the feature to manage. This approach gives you full control but requires you to declare all access in one place.

Grant a role to multiple members at once

When multiple users or service accounts need the same level of access, you can bind them all to a single role.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const binding = new gcp.gkehub.FeatureIamBinding("binding", {
    project: feature.project,
    location: feature.location,
    name: feature.name,
    role: "roles/viewer",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.gkehub.FeatureIamBinding("binding",
    project=feature["project"],
    location=feature["location"],
    name=feature["name"],
    role="roles/viewer",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/gkehub"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gkehub.NewFeatureIamBinding(ctx, "binding", &gkehub.FeatureIamBindingArgs{
			Project:  pulumi.Any(feature.Project),
			Location: pulumi.Any(feature.Location),
			Name:     pulumi.Any(feature.Name),
			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.GkeHub.FeatureIamBinding("binding", new()
    {
        Project = feature.Project,
        Location = feature.Location,
        Name = feature.Name,
        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.gkehub.FeatureIamBinding;
import com.pulumi.gcp.gkehub.FeatureIamBindingArgs;
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 FeatureIamBinding("binding", FeatureIamBindingArgs.builder()
            .project(feature.project())
            .location(feature.location())
            .name(feature.name())
            .role("roles/viewer")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:gkehub:FeatureIamBinding
    properties:
      project: ${feature.project}
      location: ${feature.location}
      name: ${feature.name}
      role: roles/viewer
      members:
        - user:jane@example.com

The FeatureIamBinding resource is authoritative for a specific role: it replaces all members for that role while preserving other roles on the feature. The members property accepts a list of identities (users, service accounts, groups). This approach works well when you manage access by role rather than by individual.

Add a single member to a role incrementally

When you need to grant access to one user without affecting other members of the same role, you can add them individually.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.gkehub.FeatureIamMember("member", {
    project: feature.project,
    location: feature.location,
    name: feature.name,
    role: "roles/viewer",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.gkehub.FeatureIamMember("member",
    project=feature["project"],
    location=feature["location"],
    name=feature["name"],
    role="roles/viewer",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/gkehub"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gkehub.NewFeatureIamMember(ctx, "member", &gkehub.FeatureIamMemberArgs{
			Project:  pulumi.Any(feature.Project),
			Location: pulumi.Any(feature.Location),
			Name:     pulumi.Any(feature.Name),
			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.GkeHub.FeatureIamMember("member", new()
    {
        Project = feature.Project,
        Location = feature.Location,
        Name = feature.Name,
        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.gkehub.FeatureIamMember;
import com.pulumi.gcp.gkehub.FeatureIamMemberArgs;
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 FeatureIamMember("member", FeatureIamMemberArgs.builder()
            .project(feature.project())
            .location(feature.location())
            .name(feature.name())
            .role("roles/viewer")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:gkehub:FeatureIamMember
    properties:
      project: ${feature.project}
      location: ${feature.location}
      name: ${feature.name}
      role: roles/viewer
      member: user:jane@example.com

The FeatureIamMember resource is non-authoritative: it adds one member to a role without affecting other members. The member property accepts a single identity. This approach works well when different teams manage access to the same feature, or when you need to grant access without knowing who else has it.

Beyond these examples

These snippets focus on specific IAM management approaches: authoritative and non-authoritative IAM management, and policy-level, role-level, and member-level access control. They’re intentionally minimal rather than full access control systems.

The examples reference pre-existing infrastructure such as GKE Hub features (by project, location, and name). They focus on IAM policy configuration rather than provisioning the features themselves.

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

  • Conditional IAM bindings (condition property)
  • Custom roles (examples use predefined roles/viewer)
  • Service account impersonation
  • IAM policy retrieval (data source usage)

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 GKE Hub Feature IAM Policy resource reference for all available configuration options.

Let's manage GCP GKE Hub Feature IAM Policies

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
Which IAM resource should I use for GKEHub Feature permissions?

You have three options:

  1. FeatureIamPolicy - Authoritative. Replaces the entire IAM policy.
  2. FeatureIamBinding - Authoritative for a specific role. Preserves other roles.
  3. FeatureIamMember - Non-authoritative. Adds a single member to a role, preserving other members.
Can I use FeatureIamPolicy with FeatureIamBinding or FeatureIamMember?
No. FeatureIamPolicy cannot be used with FeatureIamBinding or FeatureIamMember because they will conflict over the policy configuration.
Can I use FeatureIamBinding and FeatureIamMember together?
Yes, but only if they grant different roles. Using both for the same role causes conflicts.
Configuration & Usage
How do I set an authoritative IAM policy with FeatureIamPolicy?
Use gcp.organizations.getIAMPolicy to generate policy data with your bindings, then pass the policyData output to FeatureIamPolicy.
How do I grant a role to multiple members at once?
Use FeatureIamBinding with the role property and a members array containing identities like user:jane@example.com.
How do I add a single member to a role without affecting others?
Use FeatureIamMember with the role and member properties. This preserves existing members for that role.

Using a different cloud?

Explore security guides for other cloud providers: