The gcp:beyondcorp/securityGatewayIamBinding:SecurityGatewayIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for BeyondCorp Security Gateway resources. This guide focuses on three capabilities: granting roles to multiple members, adding individual members to roles, and time-based access with IAM Conditions.
Bindings reference existing Security Gateway resources and require the BeyondCorp API enabled in your project. The examples are intentionally small. Combine them with your own Security Gateway infrastructure and identity management.
Grant a role to multiple members with binding
Teams managing gateway access often need to grant the same role to multiple users or service accounts at once.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.beyondcorp.SecurityGatewayIamBinding("binding", {
project: example.project,
location: example.location,
securityGatewayId: example.securityGatewayId,
role: "roles/beyondcorp.securityGatewayUser",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.beyondcorp.SecurityGatewayIamBinding("binding",
project=example["project"],
location=example["location"],
security_gateway_id=example["securityGatewayId"],
role="roles/beyondcorp.securityGatewayUser",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/beyondcorp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := beyondcorp.NewSecurityGatewayIamBinding(ctx, "binding", &beyondcorp.SecurityGatewayIamBindingArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
SecurityGatewayId: pulumi.Any(example.SecurityGatewayId),
Role: pulumi.String("roles/beyondcorp.securityGatewayUser"),
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.Beyondcorp.SecurityGatewayIamBinding("binding", new()
{
Project = example.Project,
Location = example.Location,
SecurityGatewayId = example.SecurityGatewayId,
Role = "roles/beyondcorp.securityGatewayUser",
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.beyondcorp.SecurityGatewayIamBinding;
import com.pulumi.gcp.beyondcorp.SecurityGatewayIamBindingArgs;
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 SecurityGatewayIamBinding("binding", SecurityGatewayIamBindingArgs.builder()
.project(example.project())
.location(example.location())
.securityGatewayId(example.securityGatewayId())
.role("roles/beyondcorp.securityGatewayUser")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:beyondcorp:SecurityGatewayIamBinding
properties:
project: ${example.project}
location: ${example.location}
securityGatewayId: ${example.securityGatewayId}
role: roles/beyondcorp.securityGatewayUser
members:
- user:jane@example.com
The binding resource is authoritative for the specified role: it replaces the complete member list. The members array accepts user emails, service accounts, groups, and special identifiers like allAuthenticatedUsers. The securityGatewayId, location, and project properties identify which gateway to configure.
Add time-based access with IAM Conditions
Organizations with temporary contractors can use IAM Conditions to automatically expire permissions.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.beyondcorp.SecurityGatewayIamBinding("binding", {
project: example.project,
location: example.location,
securityGatewayId: example.securityGatewayId,
role: "roles/beyondcorp.securityGatewayUser",
members: ["user:jane@example.com"],
condition: {
title: "expires_after_2019_12_31",
description: "Expiring at midnight of 2019-12-31",
expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.beyondcorp.SecurityGatewayIamBinding("binding",
project=example["project"],
location=example["location"],
security_gateway_id=example["securityGatewayId"],
role="roles/beyondcorp.securityGatewayUser",
members=["user:jane@example.com"],
condition={
"title": "expires_after_2019_12_31",
"description": "Expiring at midnight of 2019-12-31",
"expression": "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
})
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/beyondcorp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := beyondcorp.NewSecurityGatewayIamBinding(ctx, "binding", &beyondcorp.SecurityGatewayIamBindingArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
SecurityGatewayId: pulumi.Any(example.SecurityGatewayId),
Role: pulumi.String("roles/beyondcorp.securityGatewayUser"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
Condition: &beyondcorp.SecurityGatewayIamBindingConditionArgs{
Title: pulumi.String("expires_after_2019_12_31"),
Description: pulumi.String("Expiring at midnight of 2019-12-31"),
Expression: pulumi.String("request.time < timestamp(\"2020-01-01T00:00:00Z\")"),
},
})
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.Beyondcorp.SecurityGatewayIamBinding("binding", new()
{
Project = example.Project,
Location = example.Location,
SecurityGatewayId = example.SecurityGatewayId,
Role = "roles/beyondcorp.securityGatewayUser",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Beyondcorp.Inputs.SecurityGatewayIamBindingConditionArgs
{
Title = "expires_after_2019_12_31",
Description = "Expiring at midnight of 2019-12-31",
Expression = "request.time < timestamp(\"2020-01-01T00:00:00Z\")",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.beyondcorp.SecurityGatewayIamBinding;
import com.pulumi.gcp.beyondcorp.SecurityGatewayIamBindingArgs;
import com.pulumi.gcp.beyondcorp.inputs.SecurityGatewayIamBindingConditionArgs;
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 SecurityGatewayIamBinding("binding", SecurityGatewayIamBindingArgs.builder()
.project(example.project())
.location(example.location())
.securityGatewayId(example.securityGatewayId())
.role("roles/beyondcorp.securityGatewayUser")
.members("user:jane@example.com")
.condition(SecurityGatewayIamBindingConditionArgs.builder()
.title("expires_after_2019_12_31")
.description("Expiring at midnight of 2019-12-31")
.expression("request.time < timestamp(\"2020-01-01T00:00:00Z\")")
.build())
.build());
}
}
resources:
binding:
type: gcp:beyondcorp:SecurityGatewayIamBinding
properties:
project: ${example.project}
location: ${example.location}
securityGatewayId: ${example.securityGatewayId}
role: roles/beyondcorp.securityGatewayUser
members:
- user:jane@example.com
condition:
title: expires_after_2019_12_31
description: Expiring at midnight of 2019-12-31
expression: request.time < timestamp("2020-01-01T00:00:00Z")
The condition block adds temporal or attribute-based constraints to the role binding. The expression uses Common Expression Language (CEL) to define when access is granted. Here, the condition checks request.time against a timestamp, automatically revoking access after December 31, 2019. The title and description provide human-readable context for auditing.
Add a single member to an existing role
When onboarding individual users, member resources add one identity without affecting others.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.beyondcorp.SecurityGatewayIamMember("member", {
project: example.project,
location: example.location,
securityGatewayId: example.securityGatewayId,
role: "roles/beyondcorp.securityGatewayUser",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.beyondcorp.SecurityGatewayIamMember("member",
project=example["project"],
location=example["location"],
security_gateway_id=example["securityGatewayId"],
role="roles/beyondcorp.securityGatewayUser",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/beyondcorp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := beyondcorp.NewSecurityGatewayIamMember(ctx, "member", &beyondcorp.SecurityGatewayIamMemberArgs{
Project: pulumi.Any(example.Project),
Location: pulumi.Any(example.Location),
SecurityGatewayId: pulumi.Any(example.SecurityGatewayId),
Role: pulumi.String("roles/beyondcorp.securityGatewayUser"),
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.Beyondcorp.SecurityGatewayIamMember("member", new()
{
Project = example.Project,
Location = example.Location,
SecurityGatewayId = example.SecurityGatewayId,
Role = "roles/beyondcorp.securityGatewayUser",
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.beyondcorp.SecurityGatewayIamMember;
import com.pulumi.gcp.beyondcorp.SecurityGatewayIamMemberArgs;
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 SecurityGatewayIamMember("member", SecurityGatewayIamMemberArgs.builder()
.project(example.project())
.location(example.location())
.securityGatewayId(example.securityGatewayId())
.role("roles/beyondcorp.securityGatewayUser")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:beyondcorp:SecurityGatewayIamMember
properties:
project: ${example.project}
location: ${example.location}
securityGatewayId: ${example.securityGatewayId}
role: roles/beyondcorp.securityGatewayUser
member: user:jane@example.com
The member resource is non-authoritative: it adds one identity to a role while preserving other members. Use member when you need to grant access incrementally. Use binding when you want to define the complete member list for a role. The member property accepts the same identity formats as the members array in bindings.
Beyond these examples
These snippets focus on specific IAM binding features: role binding for multiple members, single-member grants, and time-based IAM Conditions. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as BeyondCorp Security Gateway resources and a GCP project with the BeyondCorp API enabled. They focus on configuring IAM bindings rather than provisioning the gateways themselves.
To keep things focused, common IAM patterns are omitted, including:
- Full policy replacement (SecurityGatewayIamPolicy)
- Complex condition expressions (attribute-based access)
- Custom role definitions
- Audit logging configuration
These omissions are intentional: the goal is to illustrate how each IAM binding feature is wired, not provide drop-in access control modules. See the SecurityGatewayIamBinding resource reference for all available configuration options.
Let's configure GCP BeyondCorp Security Gateway 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
SecurityGatewayIamPolicy is fully authoritative and replaces the entire IAM policy. SecurityGatewayIamBinding is authoritative for a specific role, preserving other roles. SecurityGatewayIamMember is non-authoritative, adding members without affecting other members for the same role.SecurityGatewayIamPolicy cannot be used with SecurityGatewayIamBinding or SecurityGatewayIamMember as they will conflict. However, SecurityGatewayIamBinding and SecurityGatewayIamMember can be used together only if they grant different roles.IAM Configuration & Member Formats
allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:projectid, projectEditor:projectid, projectViewer:projectid, or federated identities like principal://iam.googleapis.com/locations/global/workforcePools/example-contractors/subject/joe@example.com.[projects|organizations]/{parent-name}/roles/{role-name}.location property must be omitted or set to global. If not specified, it’s parsed from the parent resource identifier or taken from the provider configuration.Conditions & Advanced Features
condition property with a title, description, and expression like request.time < timestamp("2020-01-01T00:00:00Z") to expire access at a specific time.Import & Resource Identification
pulumi import gcp:beyondcorp/securityGatewayIamBinding:SecurityGatewayIamBinding editor "projects/{{project}}/locations/{{location}}/securityGateways/{{security_gateway_id}} roles/beyondcorp.securityGatewayUser".