A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/iam/docs/tags-access-control below:

Tags and conditional access | Identity and Access Management (IAM)

Tags and conditional access

Stay organized with collections Save and categorize content based on your preferences.

This page describes how to use tags with Identity and Access Management (IAM) to help you control access to your Google Cloud resources.

To learn more about tags, see Tags overview.

Overview of tags

A tag is a key-value pair that is attached to a Google Cloud resource. You can conditionally grant IAM roles or conditionally deny IAM permissions based on whether a resource has a specific tag.

Resources inherit tag values from their parent organization, folders, and project. As a result, you can use tags to manage access to any Google Cloud resource.

These are some common use cases for managing access with tags:

Important: Do not include sensitive information in tags. Sensitive information includes personally identifiable information (PII), such as an individual's name or job title. Tags are not intended to contain sensitive information. Tag definitions and identifiers

Before you attach tags to resources, you must define the key for the tag, as well as the values that the tag allows. You can create these definitions at the organization or project level. You use Resource Manager to manage tag definitions. To learn more, see Creating and defining a new tag.

Each tag key and value has a few different identifiers:

As explained on this page, after you attach tags to a resource, you can write conditions to grant access based on tags. To write a condition, you must choose which type of identifier to use in the condition. Follow these guidelines to choose between them:

Access to tagged resources

You can use tags with IAM Conditions to grant a role conditionally, depending on the tags that are attached to or inherited by a resource. If a condition evaluates to true, then access is granted; otherwise, access is not granted. To learn more, see the overview of IAM Conditions.

Certain areas of the Google Cloud console don't recognize allow policy role bindings with tag-based conditions. As a result, if you have a role with a tag-based condition, then the Google Cloud console might incorrectly prevent you from performing certain actions. If you encounter this issue, then use an alternate method, such as the gcloud CLI, to perform the action.

Note: Conditions that check the tags for a resource and other attributes, such as the resource name or the timestamp of the request, are in preview. Such conditions are subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. For more information, see the launch stage descriptions.

Conditions that check the tags for a resource and don't check any other attributes are generally available.

The following sections show examples of condition expressions that check the tags on a resource. The condition calls different functions depending on whether it checks the permanent ID or the short name. To learn more about these functions, see Resource tags.

Conditions that use permanent IDs

This condition grants a role on resources with the tag tagKeys/123456789012: tagValues/567890123456:

resource.matchTagId('tagKeys/123456789012', 'tagValues/567890123456')

This condition grants a role on resources that have any tag with the key tagKeys/123456789012, regardless of its value:

resource.hasTagKeyId('tagKeys/123456789012')

This condition grants a role on resources that have both the tag tagKeys/123456789012: tagValues/567890123456, and any tag that uses the key tagKeys/987654321098:

resource.matchTagId('tagKeys/123456789012', 'tagValues/567890123456') &&
    resource.hasTagKeyId('tagKeys/987654321098')
Conditions that use namespaced names and short names

This condition grants a role on resources with the tag env: prod, indicating that the resource is in a production environment:

resource.matchTag('123456789012/env', 'prod')

This condition grants a role on resources that have any tag with the key env, regardless of its value:

resource.hasTagKey('123456789012/env')

This condition grants a role on resources that have both the tag env: prod and any tag that uses the key project:

resource.matchTag('123456789012/env', 'prod') &&
    resource.hasTagKey('123456789012/project')
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-13 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-13 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.5