Manage GCP Container Analysis Note IAM Bindings

The gcp:containeranalysis/noteIamBinding:NoteIamBinding resource, part of the Pulumi GCP provider, manages IAM role bindings for Container Analysis notes, controlling which identities can access vulnerability and compliance metadata. This guide focuses on two capabilities: authoritative role binding with NoteIamBinding and non-authoritative member addition with NoteIamMember.

These resources reference existing Container Analysis notes and require the Container Analysis API enabled in your project. The examples are intentionally small. Combine them with your own note resources and identity management strategy.

Grant a role to multiple members with NoteIamBinding

When you need to grant the same role to multiple users or service accounts, NoteIamBinding manages the complete member list for that role while preserving other roles on the note.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const binding = new gcp.containeranalysis.NoteIamBinding("binding", {
    project: note.project,
    note: note.name,
    role: "roles/containeranalysis.notes.occurrences.viewer",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.containeranalysis.NoteIamBinding("binding",
    project=note["project"],
    note=note["name"],
    role="roles/containeranalysis.notes.occurrences.viewer",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/containeranalysis"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := containeranalysis.NewNoteIamBinding(ctx, "binding", &containeranalysis.NoteIamBindingArgs{
			Project: pulumi.Any(note.Project),
			Note:    pulumi.Any(note.Name),
			Role:    pulumi.String("roles/containeranalysis.notes.occurrences.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.ContainerAnalysis.NoteIamBinding("binding", new()
    {
        Project = note.Project,
        Note = note.Name,
        Role = "roles/containeranalysis.notes.occurrences.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.containeranalysis.NoteIamBinding;
import com.pulumi.gcp.containeranalysis.NoteIamBindingArgs;
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 NoteIamBinding("binding", NoteIamBindingArgs.builder()
            .project(note.project())
            .note(note.name())
            .role("roles/containeranalysis.notes.occurrences.viewer")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:containeranalysis:NoteIamBinding
    properties:
      project: ${note.project}
      note: ${note.name}
      role: roles/containeranalysis.notes.occurrences.viewer
      members:
        - user:jane@example.com

The role property specifies which permission set to grant. The members array lists all identities that should have this role; NoteIamBinding replaces any existing members for this role but leaves other roles untouched. The note and project properties identify which Container Analysis note to configure.

Add a single member to a role with NoteIamMember

When you want to grant access to one additional user without affecting existing members, NoteIamMember adds a single member non-authoritatively.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.containeranalysis.NoteIamMember("member", {
    project: note.project,
    note: note.name,
    role: "roles/containeranalysis.notes.occurrences.viewer",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.containeranalysis.NoteIamMember("member",
    project=note["project"],
    note=note["name"],
    role="roles/containeranalysis.notes.occurrences.viewer",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/containeranalysis"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := containeranalysis.NewNoteIamMember(ctx, "member", &containeranalysis.NoteIamMemberArgs{
			Project: pulumi.Any(note.Project),
			Note:    pulumi.Any(note.Name),
			Role:    pulumi.String("roles/containeranalysis.notes.occurrences.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.ContainerAnalysis.NoteIamMember("member", new()
    {
        Project = note.Project,
        Note = note.Name,
        Role = "roles/containeranalysis.notes.occurrences.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.containeranalysis.NoteIamMember;
import com.pulumi.gcp.containeranalysis.NoteIamMemberArgs;
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 NoteIamMember("member", NoteIamMemberArgs.builder()
            .project(note.project())
            .note(note.name())
            .role("roles/containeranalysis.notes.occurrences.viewer")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:containeranalysis:NoteIamMember
    properties:
      project: ${note.project}
      note: ${note.name}
      role: roles/containeranalysis.notes.occurrences.viewer
      member: user:jane@example.com

The member property specifies a single identity to add to the role. Unlike NoteIamBinding, NoteIamMember preserves existing members for the same role, making it safe to use when other tools or team members manage the same role. You can use multiple NoteIamMember resources for the same role without conflicts.

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 configurations.

The examples reference pre-existing infrastructure such as Container Analysis notes and a GCP project with the Container Analysis API enabled. They focus on configuring IAM bindings rather than provisioning the underlying notes.

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

  • Conditional IAM bindings (condition property)
  • Full policy replacement (NoteIamPolicy resource)
  • Custom role definitions
  • Federated identity configuration

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 NoteIamBinding resource reference for all available configuration options.

Let's manage GCP Container Analysis Note 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 NoteIamPolicy, NoteIamBinding, and NoteIamMember?
NoteIamPolicy is authoritative for the entire IAM policy (replaces existing policy). NoteIamBinding is authoritative for a specific role (preserves other roles). NoteIamMember is non-authoritative (adds a single member without affecting other members for that role).
Can I use NoteIamPolicy with NoteIamBinding or NoteIamMember?
No, NoteIamPolicy cannot be used with NoteIamBinding or NoteIamMember because they will conflict over the policy.
Can I use NoteIamBinding and NoteIamMember together?
Yes, but only if they grant different roles. Using both for the same role will cause conflicts.
IAM Configuration
Can I create multiple NoteIamBinding resources for the same role?
No, only one NoteIamBinding can be used per role.
What format do custom roles require?
Custom roles must use the format [projects|organizations]/{parent-name}/roles/{role-name}.
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/....

Using a different cloud?

Explore security guides for other cloud providers: