The gcp:gkebackup/backupPlanIamPolicy:BackupPlanIamPolicy resource, part of the Pulumi GCP provider, manages IAM access control for GKE backup plans. This guide focuses on three approaches: authoritative policy replacement, role-level bindings, and individual member grants.
These resources reference existing backup plans by project, location, and name. The examples are intentionally small. Combine them with your own backup plan infrastructure and identity management.
Replace the entire IAM policy authoritatively
When you need complete control over backup plan access, replacing the entire IAM policy removes any unexpected permissions from previous configurations.
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.gkebackup.BackupPlanIamPolicy("policy", {
project: basic.project,
location: basic.location,
name: basic.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.gkebackup.BackupPlanIamPolicy("policy",
project=basic["project"],
location=basic["location"],
name=basic["name"],
policy_data=admin.policy_data)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/gkebackup"
"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 = gkebackup.NewBackupPlanIamPolicy(ctx, "policy", &gkebackup.BackupPlanIamPolicyArgs{
Project: pulumi.Any(basic.Project),
Location: pulumi.Any(basic.Location),
Name: pulumi.Any(basic.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.GkeBackup.BackupPlanIamPolicy("policy", new()
{
Project = basic.Project,
Location = basic.Location,
Name = basic.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.gkebackup.BackupPlanIamPolicy;
import com.pulumi.gcp.gkebackup.BackupPlanIamPolicyArgs;
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 BackupPlanIamPolicy("policy", BackupPlanIamPolicyArgs.builder()
.project(basic.project())
.location(basic.location())
.name(basic.name())
.policyData(admin.policyData())
.build());
}
}
resources:
policy:
type: gcp:gkebackup:BackupPlanIamPolicy
properties:
project: ${basic.project}
location: ${basic.location}
name: ${basic.name}
policyData: ${admin.policyData}
variables:
admin:
fn::invoke:
function: gcp:organizations:getIAMPolicy
arguments:
bindings:
- role: roles/viewer
members:
- user:jane@example.com
BackupPlanIamPolicy sets the complete IAM policy using policyData from the getIAMPolicy data source. This approach is authoritative: it replaces all existing bindings. Use this when you want to ensure no other permissions exist beyond what you explicitly define. Note that BackupPlanIamPolicy cannot be used alongside BackupPlanIamBinding or BackupPlanIamMember, as they will conflict over policy state.
Grant a role to multiple members at once
Teams often grant the same role to several users or service accounts without affecting other role assignments.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.gkebackup.BackupPlanIamBinding("binding", {
project: basic.project,
location: basic.location,
name: basic.name,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.gkebackup.BackupPlanIamBinding("binding",
project=basic["project"],
location=basic["location"],
name=basic["name"],
role="roles/viewer",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gkebackup.NewBackupPlanIamBinding(ctx, "binding", &gkebackup.BackupPlanIamBindingArgs{
Project: pulumi.Any(basic.Project),
Location: pulumi.Any(basic.Location),
Name: pulumi.Any(basic.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.GkeBackup.BackupPlanIamBinding("binding", new()
{
Project = basic.Project,
Location = basic.Location,
Name = basic.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.gkebackup.BackupPlanIamBinding;
import com.pulumi.gcp.gkebackup.BackupPlanIamBindingArgs;
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 BackupPlanIamBinding("binding", BackupPlanIamBindingArgs.builder()
.project(basic.project())
.location(basic.location())
.name(basic.name())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:gkebackup:BackupPlanIamBinding
properties:
project: ${basic.project}
location: ${basic.location}
name: ${basic.name}
role: roles/viewer
members:
- user:jane@example.com
BackupPlanIamBinding is authoritative for a single role but preserves other roles on the backup plan. The members property accepts a list of identities (users, service accounts, groups). This approach works well when managing team-level access, where multiple people need the same permissions. You can use BackupPlanIamBinding with BackupPlanIamMember as long as they don’t target the same role.
Add a single member to a role incrementally
When onboarding individual users or service accounts, you can add them without replacing the entire member list.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.gkebackup.BackupPlanIamMember("member", {
project: basic.project,
location: basic.location,
name: basic.name,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.gkebackup.BackupPlanIamMember("member",
project=basic["project"],
location=basic["location"],
name=basic["name"],
role="roles/viewer",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/gkebackup"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gkebackup.NewBackupPlanIamMember(ctx, "member", &gkebackup.BackupPlanIamMemberArgs{
Project: pulumi.Any(basic.Project),
Location: pulumi.Any(basic.Location),
Name: pulumi.Any(basic.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.GkeBackup.BackupPlanIamMember("member", new()
{
Project = basic.Project,
Location = basic.Location,
Name = basic.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.gkebackup.BackupPlanIamMember;
import com.pulumi.gcp.gkebackup.BackupPlanIamMemberArgs;
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 BackupPlanIamMember("member", BackupPlanIamMemberArgs.builder()
.project(basic.project())
.location(basic.location())
.name(basic.name())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:gkebackup:BackupPlanIamMember
properties:
project: ${basic.project}
location: ${basic.location}
name: ${basic.name}
role: roles/viewer
member: user:jane@example.com
BackupPlanIamMember is non-authoritative: it adds one member to a role without affecting other members. The member property takes a single identity string. This is the most granular approach, useful when you need to grant access incrementally without coordinating with other team members who might be managing the same role.
Beyond these examples
These snippets focus on specific IAM management approaches: authoritative vs incremental IAM management, and role binding and member assignment. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as GKE backup plans (project, location, name references). They focus on IAM policy configuration rather than provisioning backup plans or identity resources.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings
- Custom role definitions
- Service account creation and management
- Audit logging configuration
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 BackupPlanIamPolicy resource reference for all available configuration options.
Let's manage GCP GKE Backup Plan IAM Policies
Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.
Try Pulumi Cloud for FREEFrequently Asked Questions
Resource Selection & Compatibility
BackupPlanIamPolicy is authoritative and replaces the entire IAM policy. BackupPlanIamBinding is authoritative for a specific role, preserving other roles. BackupPlanIamMember is non-authoritative, adding a single member while preserving other members for that role.BackupPlanIamPolicy cannot be used with BackupPlanIamBinding or BackupPlanIamMember because they will fight over the policy. Choose either Policy alone (authoritative) or Binding/Member together.Configuration & Usage
gcp.organizations.getIAMPolicy to generate the policy data, then pass it to the policyData property of BackupPlanIamPolicy.[projects/my-project|organizations/my-org]/roles/my-custom-role when importing IAM resources with custom roles.