The gcp:logging/logViewIamBinding:LogViewIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Cloud Logging log views, controlling which identities can access specific views. This guide focuses on three capabilities: authoritative role binding with member lists, non-authoritative individual member grants, and time-based IAM Conditions.
IAM bindings for log views reference existing log views by their parent, location, bucket, and name. The examples are intentionally small. Combine them with your own log view infrastructure and identity management.
Grant a role to multiple members with LogViewIamBinding
When you need to grant the same role to multiple users or service accounts, LogViewIamBinding manages all members for that role as a single unit.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.logging.LogViewIamBinding("binding", {
parent: loggingLogView.parent,
location: loggingLogView.location,
bucket: loggingLogView.bucket,
name: loggingLogView.name,
role: "roles/logging.admin",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.logging.LogViewIamBinding("binding",
parent=logging_log_view["parent"],
location=logging_log_view["location"],
bucket=logging_log_view["bucket"],
name=logging_log_view["name"],
role="roles/logging.admin",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewLogViewIamBinding(ctx, "binding", &logging.LogViewIamBindingArgs{
Parent: pulumi.Any(loggingLogView.Parent),
Location: pulumi.Any(loggingLogView.Location),
Bucket: pulumi.Any(loggingLogView.Bucket),
Name: pulumi.Any(loggingLogView.Name),
Role: pulumi.String("roles/logging.admin"),
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.Logging.LogViewIamBinding("binding", new()
{
Parent = loggingLogView.Parent,
Location = loggingLogView.Location,
Bucket = loggingLogView.Bucket,
Name = loggingLogView.Name,
Role = "roles/logging.admin",
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.logging.LogViewIamBinding;
import com.pulumi.gcp.logging.LogViewIamBindingArgs;
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 LogViewIamBinding("binding", LogViewIamBindingArgs.builder()
.parent(loggingLogView.parent())
.location(loggingLogView.location())
.bucket(loggingLogView.bucket())
.name(loggingLogView.name())
.role("roles/logging.admin")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:logging:LogViewIamBinding
properties:
parent: ${loggingLogView.parent}
location: ${loggingLogView.location}
bucket: ${loggingLogView.bucket}
name: ${loggingLogView.name}
role: roles/logging.admin
members:
- user:jane@example.com
The binding is authoritative for the specified role: it replaces any existing members for that role on the log view. The members array accepts user accounts, service accounts, groups, and special identifiers like allAuthenticatedUsers. The parent, location, bucket, and name properties identify the log view to bind permissions to.
Add time-based conditions to role bindings
Access grants sometimes need expiration dates or time-based restrictions. IAM Conditions attach temporal constraints to role bindings.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.logging.LogViewIamBinding("binding", {
parent: loggingLogView.parent,
location: loggingLogView.location,
bucket: loggingLogView.bucket,
name: loggingLogView.name,
role: "roles/logging.admin",
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.logging.LogViewIamBinding("binding",
parent=logging_log_view["parent"],
location=logging_log_view["location"],
bucket=logging_log_view["bucket"],
name=logging_log_view["name"],
role="roles/logging.admin",
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/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewLogViewIamBinding(ctx, "binding", &logging.LogViewIamBindingArgs{
Parent: pulumi.Any(loggingLogView.Parent),
Location: pulumi.Any(loggingLogView.Location),
Bucket: pulumi.Any(loggingLogView.Bucket),
Name: pulumi.Any(loggingLogView.Name),
Role: pulumi.String("roles/logging.admin"),
Members: pulumi.StringArray{
pulumi.String("user:jane@example.com"),
},
Condition: &logging.LogViewIamBindingConditionArgs{
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.Logging.LogViewIamBinding("binding", new()
{
Parent = loggingLogView.Parent,
Location = loggingLogView.Location,
Bucket = loggingLogView.Bucket,
Name = loggingLogView.Name,
Role = "roles/logging.admin",
Members = new[]
{
"user:jane@example.com",
},
Condition = new Gcp.Logging.Inputs.LogViewIamBindingConditionArgs
{
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.logging.LogViewIamBinding;
import com.pulumi.gcp.logging.LogViewIamBindingArgs;
import com.pulumi.gcp.logging.inputs.LogViewIamBindingConditionArgs;
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 LogViewIamBinding("binding", LogViewIamBindingArgs.builder()
.parent(loggingLogView.parent())
.location(loggingLogView.location())
.bucket(loggingLogView.bucket())
.name(loggingLogView.name())
.role("roles/logging.admin")
.members("user:jane@example.com")
.condition(LogViewIamBindingConditionArgs.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:logging:LogViewIamBinding
properties:
parent: ${loggingLogView.parent}
location: ${loggingLogView.location}
bucket: ${loggingLogView.bucket}
name: ${loggingLogView.name}
role: roles/logging.admin
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 a CEL expression that must evaluate to true for the binding to take effect. Here, the expression checks that the request time is before midnight on January 1, 2020. The title and description provide human-readable context for the condition. Note that IAM Conditions have known limitations documented by Google Cloud.
Add individual members with LogViewIamMember
When you need to grant access to one user without affecting other members of the same role, LogViewIamMember provides non-authoritative access control.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.logging.LogViewIamMember("member", {
parent: loggingLogView.parent,
location: loggingLogView.location,
bucket: loggingLogView.bucket,
name: loggingLogView.name,
role: "roles/logging.admin",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.logging.LogViewIamMember("member",
parent=logging_log_view["parent"],
location=logging_log_view["location"],
bucket=logging_log_view["bucket"],
name=logging_log_view["name"],
role="roles/logging.admin",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewLogViewIamMember(ctx, "member", &logging.LogViewIamMemberArgs{
Parent: pulumi.Any(loggingLogView.Parent),
Location: pulumi.Any(loggingLogView.Location),
Bucket: pulumi.Any(loggingLogView.Bucket),
Name: pulumi.Any(loggingLogView.Name),
Role: pulumi.String("roles/logging.admin"),
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.Logging.LogViewIamMember("member", new()
{
Parent = loggingLogView.Parent,
Location = loggingLogView.Location,
Bucket = loggingLogView.Bucket,
Name = loggingLogView.Name,
Role = "roles/logging.admin",
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.logging.LogViewIamMember;
import com.pulumi.gcp.logging.LogViewIamMemberArgs;
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 LogViewIamMember("member", LogViewIamMemberArgs.builder()
.parent(loggingLogView.parent())
.location(loggingLogView.location())
.bucket(loggingLogView.bucket())
.name(loggingLogView.name())
.role("roles/logging.admin")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:logging:LogViewIamMember
properties:
parent: ${loggingLogView.parent}
location: ${loggingLogView.location}
bucket: ${loggingLogView.bucket}
name: ${loggingLogView.name}
role: roles/logging.admin
member: user:jane@example.com
Unlike LogViewIamBinding, this resource adds a single member to a role without replacing existing members. Multiple LogViewIamMember resources can target the same role, and they can coexist with LogViewIamBinding resources as long as they don’t grant the same 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 with member lists, individual 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 log views (parent, location, bucket, name references). They focus on configuring IAM bindings rather than provisioning the log views themselves.
To keep things focused, common IAM patterns are omitted, including:
- LogViewIamPolicy for full policy replacement
- Attribute-based conditions beyond time expressions
- Custom role definitions
- Service account creation and management
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 LogViewIamBinding resource reference for all available configuration options.
Let's configure GCP Logging View IAM Permissions
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.logging.LogViewIamPolicy is authoritative and replaces the entire IAM policy. gcp.logging.LogViewIamBinding is authoritative for a specific role, preserving other roles. gcp.logging.LogViewIamMember is non-authoritative, adding individual members without affecting existing ones.gcp.logging.LogViewIamPolicy cannot be used with gcp.logging.LogViewIamBinding or gcp.logging.LogViewIamMember because they will conflict over the policy state.IAM Configuration
allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner/Editor/Viewer:{projectid}, and federated identities like principal://iam.googleapis.com/....condition property with title, description, and expression. For example, set expression: "request.time < timestamp(\"2020-01-01T00:00:00Z\")" to expire access at a specific time.Advanced Configuration
projects/{project-id}/roles/{role-name} or organizations/{org-id}/roles/{role-name}.bucket, location, name, parent, role, and condition properties are immutable and cannot be modified after the resource is created.gcp.logging.LogViewIamBinding resource can be used per role. To add multiple members to the same role, include them all in the members array of a single binding.