The gcp:gkehub/featureIamBinding:FeatureIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for GKE Hub features, controlling which identities can access specific features. This guide focuses on two capabilities: authoritative role binding (managing all members for one role) and incremental member addition (adding one member at a time).
IAM bindings reference existing GKE Hub features and require project and location identifiers. The examples are intentionally small. Combine them with your own GKE Hub feature resources and identity management strategy.
Grant a role to multiple members at once
Teams managing GKE Hub features often need to grant the same role to multiple users, service accounts, or groups simultaneously.
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 manages all members for a specific role as a single unit. The members array lists all identities that receive the role; updating this list replaces the entire membership. The role property specifies which permissions to grant, while project, location, and name identify the target feature. This approach works well when you manage a role’s complete membership in one place.
Add a single member to an existing role
When you need to grant access to one additional user without affecting other members of the same role, FeatureIamMember provides non-authoritative updates.
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 adds a single identity to a role without replacing existing members. The member property specifies one identity (user, service account, group, or federated identity), while the role property determines which permissions to grant. This resource preserves other members of the same role, making it safe to use alongside other IAM configurations. Use this when different teams or modules need to grant the same role independently.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control and member management (authoritative and incremental). They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as GKE Hub features and GCP project and location configuration. They focus on configuring IAM bindings rather than provisioning the underlying features.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Policy-level management (FeatureIamPolicy resource)
- Custom role definitions
- Federated identity configuration details
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 GKE Hub FeatureIamBinding resource reference for all available configuration options.
Let's configure GCP GKE Hub Feature 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
gcp.gkehub.FeatureIamPolicy is authoritative and replaces the entire IAM policy. gcp.gkehub.FeatureIamBinding is authoritative for a specific role but preserves other roles. gcp.gkehub.FeatureIamMember is non-authoritative and preserves other members for the same role.gcp.gkehub.FeatureIamPolicy cannot be used with gcp.gkehub.FeatureIamBinding or gcp.gkehub.FeatureIamMember because they will conflict over the policy configuration.Configuration & Syntax
[projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role or organizations/my-org/roles/my-custom-role.allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, and federated identities like principal://iam.googleapis.com/....role, location, name, project, and condition properties are all immutable and cannot be modified after the resource is created.gcp.gkehub.FeatureIamBinding with the members array property, for example members: ["user:jane@example.com", "user:john@example.com"].