This page describes tags and how to use them with
Datastream. To use the Google Cloud CLI to attach, detach, and list
tags on your Datastream resources, see
[Manage tags](https://docs.cloud.google.com/datastream/docs/manage-tags).

Tags are a way to organize your Datastream resources. These resources
include private connectivity configurations, connection profiles, and streams.

Tags are applied at higher levels of the
[resource hierarchy](https://docs.cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy)
across Google Cloud. Datastream and other resources inherit the tags.
They are managed using
[Resource Manager](https://docs.cloud.google.com/resource-manager/docs/tags/tags-overview).
You can add a reference to tags in
[Identity and Access Management (IAM) policy bindings](https://docs.cloud.google.com/iam/docs/tags-access-control)
to grant conditional access to resources.

Tags are different from
[labels](https://docs.cloud.google.com/resource-manager/docs/creating-managing-labels#what-are-labels),
which are another way to organize and filter your resources in
Datastream. Tags and labels work independently of each other, and you
can use both on the same resource. You can learn about using labels with
Datastream resources, including
[connection profiles](https://docs.cloud.google.com/datastream/docs/create-connection-profiles) and
[streams](https://docs.cloud.google.com/datastream/docs/create-a-stream).

## What are tags?

Tags are key-value pairs you can apply to your Datastream resources for
fine-grained access control.

A tag key could be a property, such as `environment`, and the tag value could be
an attribute, such as `development` or `production`. A tag can have only one
value for a given key on a particular resource.

Tags are created at the organization level. Tags are attached to resources, such
as a project or a Datastream private connectivity configuration,
connection profile, or stream, through the
[Resource Manager](https://docs.cloud.google.com/resource-manager/docs/tags/tags-overview), which is used
across Google Cloud.

## Grant permissions based on conditional tag bindings

After a tag is attached to or inherited by a Datastream resource,
you can [use the tag](https://docs.cloud.google.com/iam/docs/conditions-attribute-reference#resource-tags)
with IAM Conditions to grant access to Datastream
resources conditionally. IAM Conditions let you impose
fine-grained access control on Datastream resources. To use
IAM Conditions, you reference the tag in IAM
policy bindings.

## Restrictions

Tags have the following restrictions:

- [Organization policies](https://docs.cloud.google.com/resource-manager/docs/organization-policy/tags-organization-policy) can conditionally reference tags inherited from the project level and higher, but don't support tags that are directly attached to Datastream resources.
- [Cloud Audit Logs](https://docs.cloud.google.com/logging/docs/audit) show the creation and deletion of tags, but entries aren't generated for attaching tags and viewing tag bindings on Datastream resources.

## What's next

- Learn how to use Resource Manager to [create and manage tags for your Datastream resources](https://docs.cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing).
- See specific `gcloud` commands to attach, detach, and list tags on your Datastream resources in [Manage tags](https://docs.cloud.google.com/datastream/docs/manage-tags).