This document describes how to create secure tags, attach them to a Managed Service for Apache Spark cluster, and then use the tags to secure cluster networking.
Secure tags have key differences from network tags, including Identity and Access Management access control, tag inheritance, and single VPC network binding, which produce the following key benefits:
Using secure tags in IAM policies enable conditional access control, strengthening security by granting or denying roles based on the presence of tags.
Unlike VPC firewall rules, network firewall policies that are enhanced by secure tags enable efficient grouping and simultaneous updating of multiple rules, all governed by IAM access controls. Compared to VPC firewall rules that utilize network tags, secure tags provide enhanced security and management capabilities within network firewall policies.
To learn more about the differences between Resource Manager tags and network tags, see Comparison of Tags and network tags.
To learn more about the differences between Resource Manager tags and labels, see Tags and labels.
Certain IAM roles are required to run the examples on this page. Depending on organization policies, these roles may have already been granted. To check role grants, see Do you need to grant roles?.
For more information about granting roles, see Manage access to projects,folders, and organizations.
To get the permissions that
you need to create tags,
ask your administrator to grant you the
Tag Administrator (roles/resourcemanager.tagAdmin) IAM role on Resource Manager tags.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
To ensure that Managed Service for Apache Spark Service Agent service account has the necessary
permissions to attach secure tags to a Managed Service for Apache Spark cluster,
ask your administrator to grant the
Managed Service for Apache Spark Service Agent role (roles/dataproc.serviceAgent) IAM role to Managed Service for Apache Spark Service Agent service account on the project.
To attach a secure tag to a Managed Service for Apache Spark cluster, you must first create a Resource Manager tag with a specified key and one or more values.
Create a Managed Service for Apache Spark cluster, specifying the secure tag
TAG_KEY:TAG_VALUE pair.
To create a Managed Service for Apache Spark cluster and add a secure tag to the
cluster, run the
gcloud Managed Service for Apache Spark clusters create
command with the --resource-manager-tags flag.
gcloud dataproc clusters create CLUSTER_NAME \
--region REGION \
--resource-manager-tags=TAG_KEY=TAG_VALUE
Replace the following:
PROJECT-ID/KEY_NAME=PROJECT-ID/KEY_NAME/KEY_VALUE.
Example:
--resource-manager-tags="test-project/testkey"=test-project/testkey/testvalue
tagKeys/TAG_KEY_ID=tagValues/TAG_VALUE_ID
Example:
--resource-manager-tags=tagKeys/123456789012=tagValues/987654321098
To create a Managed Service for Apache Spark cluster and add a secure tag to the
cluster, include the
resourceManagerTags
field as part of a
clusters.create
request that includes attaching a "TAG_KEY":"TAG_VALUE"
secure tag to the cluster.
{
"clusterName": "CLUSTER_NAME",
"config": {
"gceClusterConfig": {
"resourceManagerTags": {
"TAG_KEY":"TAG_VALUE"
}
}
}
}
Replace the following:
PROJECT-ID/KEY_NAME:PROJECT-ID/KEY_NAME/KEY_VALUE.
Example:
"test-project/testkey":"test-project/testkey/testvalue"
tagKeys/TAG_KEY_ID:tagValues/TAG_VALUE_ID
Example:
"tagKeys/123456789012":"tagValues/987654321098"
After attaching secure tags to a cluster, use secure tags to configure cluster networking:
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 2026-07-22 UTC.