Configure GCP BeyondCorp Security Gateway IAM Bindings

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: authoritative role-to-members binding, time-based access with IAM Conditions, and non-authoritative member addition.

IAM resources reference an existing Security Gateway and require project and location identifiers. The examples are intentionally small. Combine them with your own Security Gateway infrastructure and identity management strategy.

Grant a role to multiple members with Binding

When managing gateway access, teams often need to grant the same role to multiple users or service accounts simultaneously.

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 SecurityGatewayIamBinding resource is authoritative for the specified role. It replaces the entire member list for that role on the Security Gateway. The members array accepts user accounts, 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 implementing temporary access use IAM Conditions to automatically expire permissions without manual cleanup.

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 property uses Common Expression Language (CEL) to define when the binding applies. Here, the binding expires at midnight on 2020-01-01. The title and description properties document the condition’s purpose for auditing and troubleshooting.

Add individual members with Member resource

When you need to grant access to one user without affecting other members of the same role, use SecurityGatewayIamMember for additive access control.

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

Unlike SecurityGatewayIamBinding, the SecurityGatewayIamMember resource is non-authoritative. It adds a single member to a role without replacing existing members. This allows multiple team members or automation systems to manage access independently. The member property accepts the same identity formats as the members array in Binding resources.

Beyond these examples

These snippets focus on specific IAM binding features: role-based access control (Binding vs Member) and time-based access with IAM Conditions. They’re intentionally minimal rather than full access control policies.

The examples reference pre-existing infrastructure such as BeyondCorp Security Gateway resources and Google Cloud project with location configuration. They focus on configuring IAM bindings rather than provisioning the underlying gateway infrastructure.

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

  • Full policy replacement (SecurityGatewayIamPolicy)
  • Custom role definitions and formatting
  • Federated identity and workload identity pool configuration
  • Conflict resolution between Policy, Binding, and Member resources

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 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 FREE

Frequently Asked Questions

Resource Selection & Conflicts
What's the difference between SecurityGatewayIamPolicy, IamBinding, and IamMember?
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 role.
Can I mix these IAM resources together?
SecurityGatewayIamPolicy cannot be used with SecurityGatewayIamBinding or SecurityGatewayIamMember as they’ll conflict. You can use IamBinding and IamMember together only if they manage different roles.
IAM Configuration
What member identity formats are supported?
Supported formats include allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:projectid, projectEditor:projectid, projectViewer:projectid, and federated identities like principal://iam.googleapis.com/....
What format do custom roles require?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}. The role property is required and immutable.
What value should I set for location?
The 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.
IAM Conditions
How do I add time-based access restrictions?
Use the condition property with title, description, and expression. For example, set expression to request.time < timestamp("2020-01-01T00:00:00Z") to expire access at a specific time.
What are the limitations of IAM Conditions?
IAM Conditions have known limitations documented at https://cloud.google.com/iam/docs/conditions-overview#limitations. Review these before implementing conditional access.
Are IAM Conditions required?
No, the condition property is optional. You can grant unconditional access by omitting it, as shown in the basic binding examples.

Using a different cloud?

Explore security guides for other cloud providers: