The gcp:tags/tagValueIamBinding:TagValueIamBinding resource, part of the Pulumi GCP provider, grants IAM roles to members for a specific tag value, controlling who can view, edit, or manage tags. This guide focuses on two capabilities: authoritative role bindings for multiple members and non-authoritative member additions.
IAM bindings for tag values work alongside TagValueIamMember resources (for different roles) and reference existing TagValue resources. The examples are intentionally small. Combine them with your own tag hierarchies and identity management.
Grant a role to multiple members
Teams managing tag-based access control often grant the same role to multiple users or service accounts at once, ensuring consistent permissions.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const binding = new gcp.tags.TagValueIamBinding("binding", {
tagValue: value.name,
role: "roles/viewer",
members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp
binding = gcp.tags.TagValueIamBinding("binding",
tag_value=value["name"],
role="roles/viewer",
members=["user:jane@example.com"])
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/tags"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := tags.NewTagValueIamBinding(ctx, "binding", &tags.TagValueIamBindingArgs{
TagValue: pulumi.Any(value.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.Tags.TagValueIamBinding("binding", new()
{
TagValue = @value.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.tags.TagValueIamBinding;
import com.pulumi.gcp.tags.TagValueIamBindingArgs;
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 TagValueIamBinding("binding", TagValueIamBindingArgs.builder()
.tagValue(value.name())
.role("roles/viewer")
.members("user:jane@example.com")
.build());
}
}
resources:
binding:
type: gcp:tags:TagValueIamBinding
properties:
tagValue: ${value.name}
role: roles/viewer
members:
- user:jane@example.com
The binding resource is authoritative for the specified role: it replaces any existing members for that role on the tag value. The members array accepts user emails, service accounts, groups, and special identifiers like allAuthenticatedUsers. The tagValue property references the tag value resource by name.
Add a single member to a role
When onboarding individual users, you can add them to existing roles without affecting other members.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const member = new gcp.tags.TagValueIamMember("member", {
tagValue: value.name,
role: "roles/viewer",
member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp
member = gcp.tags.TagValueIamMember("member",
tag_value=value["name"],
role="roles/viewer",
member="user:jane@example.com")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/tags"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := tags.NewTagValueIamMember(ctx, "member", &tags.TagValueIamMemberArgs{
TagValue: pulumi.Any(value.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.Tags.TagValueIamMember("member", new()
{
TagValue = @value.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.tags.TagValueIamMember;
import com.pulumi.gcp.tags.TagValueIamMemberArgs;
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 TagValueIamMember("member", TagValueIamMemberArgs.builder()
.tagValue(value.name())
.role("roles/viewer")
.member("user:jane@example.com")
.build());
}
}
resources:
member:
type: gcp:tags:TagValueIamMember
properties:
tagValue: ${value.name}
role: roles/viewer
member: user:jane@example.com
TagValueIamMember is non-authoritative: it adds one member to a role without replacing existing members. This differs from TagValueIamBinding, which replaces all members for a role. Use member resources when you need incremental access grants; use binding resources when you want to define the complete member list for a role.
Beyond these examples
These snippets focus on specific IAM binding features: role-based access control and authoritative vs non-authoritative grants. They’re intentionally minimal rather than full access control configurations.
The examples reference pre-existing infrastructure such as TagValue resources (referenced by name). They focus on configuring IAM bindings rather than creating the tag hierarchy itself.
To keep things focused, common IAM patterns are omitted, including:
- Conditional IAM bindings (condition property)
- Policy-level management (TagValueIamPolicy)
- Custom role definitions
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 TagValueIamBinding resource reference for all available configuration options.
Let's manage GCP Tag Value 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
TagValueIamPolicy is authoritative and replaces the entire IAM policy. TagValueIamBinding is authoritative for a single role, preserving other roles in the policy. TagValueIamMember is non-authoritative, adding individual members without affecting other members for the same role.TagValueIamPolicy cannot be used with TagValueIamBinding or TagValueIamMember because they will conflict over policy control.Configuration & Formats
[projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role or organizations/my-org/roles/my-custom-role.allUsers, allAuthenticatedUsers, user:{email}, serviceAccount:{email}, group:{email}, domain:{domain}, projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid}, and federated identities like principal://iam.googleapis.com/....Immutability & Limitations
role, tagValue, and condition properties are immutable and cannot be changed after the resource is created.