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 feature resources. This guide focuses on two capabilities: authoritative role binding (managing all members for one role) and non-authoritative member addition (adding one member at a time).
IAM bindings reference existing GKE Hub features by project, location, and name. The examples are intentionally small. Combine them with your own GKE Hub feature infrastructure and identity management strategy.
Grant a role to multiple members at once
When managing access to GKE Hub features, you often need to grant the same role to multiple users, service accounts, or groups. FeatureIamBinding manages all members for a single role as a unit, replacing any existing members for that 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 role property specifies which IAM role to grant (e.g., “roles/viewer”). The members array lists all identities that should have this role. This resource is authoritative for the specified role: it replaces any existing members, so include everyone who needs access. The project, location, and name properties identify which GKE Hub feature to bind the policy to.
Add a single member to a role incrementally
When you need to add individual users without affecting other members of the same role, FeatureIamMember provides non-authoritative access control.
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 member property specifies a single identity to grant access. Unlike FeatureIamBinding, this resource is non-authoritative: it adds one member without removing others who already have the role. Use this when you want to grant access incrementally or when multiple teams manage access to the same feature.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control and authoritative vs non-authoritative member management. They’re intentionally minimal rather than full access control solutions.
The examples reference pre-existing infrastructure such as GKE Hub features (identified by project, location, and name). They focus on configuring IAM bindings rather than provisioning the features themselves.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Full policy replacement (FeatureIamPolicy resource)
- Custom role definitions
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 cannot be used with gcp.gkehub.FeatureIamBinding or gcp.gkehub.FeatureIamMember because they will fight over the IAM policy. Choose one approach: use FeatureIamPolicy alone for full control, or use Binding/Member resources for granular management.FeatureIamPolicy is authoritative and replaces the entire IAM policy. FeatureIamBinding is authoritative for a specific role but preserves other roles. FeatureIamMember is non-authoritative and adds a single member to a role while preserving other members.Configuration & Identity Formats
members property supports multiple formats: 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 example, projects/my-project/roles/my-custom-role or organizations/my-org/roles/my-custom-role. This applies to both resource creation and import.Immutability & Lifecycle
location, name, project, and role properties are all immutable. Changing any of these requires recreating the resource.