Es posible que parte de la información de esta página (o toda) no se aplique a Trusted Cloud de S3NS. Consulta
Diferencias con Google Cloud para obtener más detalles.
Aplica la política de la organización con el Administrador de recursos
Antes de comenzar
-
Verify that billing is enabled for your Trusted Cloud project.
-
Enable the Compute Engine and Resource Manager APIs.
Enable the APIs
-
Make sure that you have the following role or roles on the organization:
Organization Policy > Organization Policy Administrator, Compute Engine > Compute Storage Admin
Check for the roles
-
In the Trusted Cloud console, go to the IAM page.
Go to IAM
-
Select the organization.
-
In the Principal column, find all rows that identify you or a group that
you're included in. To learn which groups you're included in, contact your
administrator.
-
For all rows that specify or include you, check the Role column to see whether
the list of roles includes the required roles.
Grant the roles
-
In the Trusted Cloud console, go to the IAM page.
Ir a IAM
-
Selecciona la organización.
-
Haz clic en person_addGrant access.
-
En el campo Principales nuevas, ingresa tu identificador de usuario.
Por lo general, este es el identificador de un usuario en un grupo de Workforce Identity. Para obtener más información, consulta Representa a los usuarios del grupo de personal en políticas de IAM o comunícate con tu administrador.
-
En la lista Seleccionar un rol, elige un rol.
-
Para otorgar funciones adicionales, haz clic en add Agregar otro rol y agrega cada rol adicional.
-
Haz clic en Guardar.
Crea un proyecto nuevo
Para crear un recurso de proyecto, completa los pasos siguientes:
Para crear un proyecto nuevo, haz lo siguiente:
-
Ve a la página Administrar recursos en la Trusted Cloud consola.
Ir a Administrar recursos
Los pasos restantes aparecen en la consola de Trusted Cloud .
-
En la lista desplegable Seleccionar una organización, en la parte superior de la página, selecciona el
recurso de la organización en la que deseas crear un proyecto. Si eres un usuario de prueba gratuita, omite este paso, ya que no aparece esta lista.
- Haz clic en Crear proyecto.
-
En la ventana Proyecto nuevo que aparece, ingresa un nombre de proyecto y selecciona una cuenta de facturación según corresponda. El nombre de un proyecto solo puede contener letras, números, comillas
simples, guiones, espacios o signos de exclamación, y debe tener entre 4 y 30 caracteres.
-
Ingresa el recurso de la organización o la carpeta superior en el cuadro Ubicación. Ese recurso
será el superior de la jerarquía del proyecto nuevo. Si aparece Sin organización como opción,
puedes seleccionarla para crear tu proyecto nuevo como el nivel superior de su propia jerarquía de recursos.
- Cuando hayas terminado de ingresar los detalles del proyecto nuevo, haz clic en Crear.
Después de crear el proyecto, se te asigna la función Propietario.
En esta función, se incluyen todos los permisos necesarios para la guía de inicio rápido siguiente.
Para obtener más información sobre los permisos, consulta Cómo otorgar, cambiar y revocar el acceso a los recursos.
Crea un disco de Compute Engine
Para probar la funcionalidad de la restricción de ubicaciones de recursos, configura los discos persistentes regionales de Compute Engine. Cuando creas un disco persistente regional, debes especificar la ubicación en la que residirá. Para obtener más información sobre cómo crear discos persistentes regionales de Compute Engine, consulta Crea y administra volúmenes de Persistent Disk regional.
En la consola de Trusted Cloud , ve a la página Discos.
Ir a Discos
Selecciona el proyecto que creaste anteriormente.
- Si se te solicita que vincules una cuenta de facturación a tu proyecto, hazlo ahora.
Para obtener más información sobre cómo habilitar la facturación, consulta Modifica la configuración de facturación de un proyecto.
Haz clic en Crear disco.
Especifica un Nombre para el disco.
Selecciona Replica este disco dentro de la región.
En Región, selecciona europe-north1 (Finland)
.
En Zonas, selecciona europe-north1-a
y europe-north1-b
.
Haz clic en Crear.
Cuando el disco se crea correctamente, aparece una marca de verificación verde junto al nombre.
Establece la política de la organización
Para establecer una política de la organización en el proyecto que creaste, haz lo siguiente:
En la consola de Trusted Cloud , ve a la página Políticas de la organización.
Ir a Políticas de la organización
Haz clic en Seleccionar.
Selecciona el proyecto que creaste.
Haz clic en Google Cloud Platform - Definir ubicaciones de recursos y, luego, haz clic en Editar.
En Se aplica a, selecciona Personalizar.
En Valores de la política, selecciona Personalizar.
En Tipo de política, selecciona Permitir.
En el cuadro Valor de la política, ingresa in:asia-locations
.
Haz clic en Guardar. Aparece una notificación para confirmar la actualización de la política.
asia-locations
es un grupo de valores creado con Google para incluir todas las ubicaciones en una región geográfica particular.
En este caso, cada región de Asia se define como una ubicación permitida para cualquier recurso creado después de este punto. Ten en cuenta que con esta política nueva no se modifica el disco persistente regional que creaste anteriormente, ya que la política no es retroactiva.
Prueba la política de la organización
Ahora que la política de la organización está vigente, no puedes crear recursos en regiones que no se hayan especificado como parte de la política de la organización. Para probar esto, intenta crear un disco persistente regional en una ubicación no válida de la manera siguiente:
En la consola de Trusted Cloud , ve a la página Discos.
Ir a Discos
Selecciona el proyecto que creaste anteriormente.
Haz clic en Crear disco.
Especifica un Nombre para el disco.
Selecciona Replica este disco dentro de la región.
En Región, selecciona europe-north1 (Finland)
.
En Zonas, selecciona europe-north1-a
y europe-north1-b
.
Haz clic en Crear.
Aparece un signo de exclamación rojo junto al nombre y la notificación de error siguiente:
Location ZONE:europe-north1-a violates constraint
constraints/gcp.resourceLocations on the resource RESOURCE_ID
En la que RESOURCE_ID es la ruta de recursos completa de tu proyecto y disco.
No se creó el disco.
Crea un disco persistente regional en una ubicación válida
La restricción de la política de la organización bloquea la creación de recursos, a menos que especifiques una ubicación válida de la manera siguiente:
En la consola de Trusted Cloud , ve a la página Discos.
Ir a Discos
Selecciona el proyecto que creaste anteriormente.
Haz clic en Crear disco.
Especifica un Nombre para el disco.
Selecciona Replica este disco dentro de la región.
En Región, selecciona asia-east2 (Hong Kong)
.
En Zonas, selecciona asia-east2-a
y asia-east2-b
.
Haz clic en Crear.
El recurso se crea correctamente porque todas las zonas que se incluyen en asia-east2
están dentro del grupo de valores asia-locations
.
Limpia
Sigue estos pasos para evitar que se apliquen cargos a tu cuenta de Trusted Cloud por los recursos que usaste en esta página.
Borra discos persistentes regionales
Borra los discos persistentes regionales que creaste para esta guía de inicio rápido de la manera siguiente:
En la consola de Trusted Cloud , ve a la página Discos.
Ir a Discos
En la lista que aparece, selecciona los dos discos que creaste.
A la derecha del botón Crear disco, haz clic en Borrar.
En el diálogo de confirmación que aparece, haz clic en Borrar.
Aparece un diálogo de notificación para confirmar que se borraron los discos.
Borra el proyecto
Borra el proyecto que creaste para esta guía de inicio rápido de la manera siguiente:
En la consola de Trusted Cloud , ve a la página Administrar recursos.
Ir a Administrar recursos
En el menú desplegable de la parte superior de la página, selecciona la organización en la que creaste el proyecto de guía de inicio rápido.
En la lista de recursos del proyecto que aparece, selecciona el proyecto que creaste y haz clic en Borrar.
En el diálogo Cerrar el proyecto que aparece, ingresa el ID del proyecto y, luego, haz clic en Cerrar.
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-08-18 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-08-18 (UTC)"],[],[],null,["# Quickstart: Enforce organization policy by using Resource Manager\n\nEnforce organization policy by using Resource Manager\n=====================================================\n\nThis guide describes how to set an [organization policy](/resource-manager/docs/organization-policy/overview) that\nincludes the [resource locations](/resource-manager/docs/organization-policy/defining-locations) constraint, and\nhow to test that constraint after it is applied in the\n[Google Cloud console](https://console.cloud.google.com/).\n\nBefore you begin\n----------------\n\n1.\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n2.\n\n\n Enable the Compute Engine and Resource Manager APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=compute.googleapis.com,cloudresourcemanager.googleapis.com&redirect=https://console.cloud.google.com)\n3.\n\n Make sure that you have the following role or roles on the organization:\n\n Organization Policy \\\u003e Organization Policy Administrator, Compute Engine \\\u003e Compute Storage Admin\n\n #### Check for the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=organizationId)\n 2. Select the organization.\n 3.\n In the **Principal** column, find all rows that identify you or a group that\n you're included in. To learn which groups you're included in, contact your\n administrator.\n\n 4. For all rows that specify or include you, check the **Role** column to see whether the list of roles includes the required roles.\n\n #### Grant the roles\n\n 1.\n In the Google Cloud console, go to the **IAM** page.\n\n [Go to IAM](https://console.cloud.google.com/projectselector/iam-admin/iam?supportedpurview=organizationId)\n 2. Select the organization.\n 3. Click person_add **Grant access**.\n 4.\n In the **New principals** field, enter your user identifier.\n\n This is typically the email address for a Google Account.\n\n 5. In the **Select a role** list, select a role.\n 6. To grant additional roles, click add **Add\n another role** and add each additional role.\n 7. Click **Save**.\n\nCreate new Project\n------------------\n\nTo create a Project resource, follow the steps below:\n\nTo create a new project, do the following:\n\n1. Go to the **Manage resources** page in the Google Cloud console.\n\n [Go to Manage Resources](https://console.cloud.google.com/cloud-resource-manager?walkthrough_id=resource-manager--create-project&start_index=1#step_index=1)\n\n The remaining steps appear in the Google Cloud console.\n2. On the **Select organization** drop-down list at the top of the page, select the organization resource in which you want to create a project. If you are a free trial user, skip this step, as this list does not appear.\n3. Click **Create Project**.\n4. In the **New Project** window that appears, enter a project name and select a billing account as applicable. A project name can contain only letters, numbers, single quotes, hyphens, spaces, or exclamation points, and must be between 4 and 30 characters.\n5. Enter the parent organization or folder resource in the **Location** box. That resource will be the hierarchical parent of the new project. If **No organization** is an option, you can select it to create your new project as the top level of its own resource hierarchy.\n6. When you're finished entering new project details, click **Create**.\n\nAfter you create the Project, the **Owner** role is assigned to you.\nThis role includes all of the permissions you need for the following quickstart.\nFor more information about permissions, see\n[Granting, changing, and revoking access to resources](/iam/docs/granting-changing-revoking-access).\n\nCreate a Compute Engine disk\n----------------------------\n\nTo test the functionality of the resource locations constraint, set up\nCompute Engine regional persistent disks. When you create a regional\npersistent disk, you must specify the location where it will reside. For more\ninformation about creating Compute Engine regional persistent disks, see\n[Create and manage regional Persistent Disk volumes](/compute/docs/disks/regional-persistent-disk).\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. Select the Project you created previously.\n\n 1. If you are prompted to link a billing account to your Project, do so now. For more information about enabling billing, see [Modify a Project's Billing Settings](/billing/docs/how-to/modify-project#enable_billing_for_a_project).\n3. Click **Create Disk**.\n\n4. Specify a **Name** for your disk.\n\n5. Select **Replicate this disk within region**.\n\n6. Under **Region** , select `europe-north1 (Finland)`.\n\n7. Under **Zones** , select `europe-north1-a` and `europe-north1-b`.\n\n8. Click **Create**.\n\nWhen the disk is successfully created, a green check mark appears next to the\nname.\n\nSet the organization policy\n---------------------------\n\nTo set an organization policy on the Project you created:\n\n1. In the Google Cloud console, go to the **Organization policies** page.\n\n [Go to Organization policies](https://console.cloud.google.com/iam-admin/orgpolicies)\n2. Click **Select**.\n\n3. Select the Project you created.\n\n4. Click **Google Cloud Platform - Define Resource Locations** , and then\n click **Edit**.\n\n5. Under **Applies to** , select **Customize**.\n\n6. Under **Policy values** , select **Custom**.\n\n7. Under **Policy type** , select **Allow**.\n\n8. In the **Policy value** box, enter `in:asia-locations`.\n\n9. Click **Save**. A notification appears to confirm the policy update.\n\n`asia-locations` is a [value group](/resource-manager/docs/organization-policy/defining-locations#value_groups) that is\ncurated by Google to include every location in a particular geographic region.\nIn this case, every region in Asia is defined as an allowed location for any\nresources created after this point. Note that the regional persistent disk you\ncreated above is not affected by this new policy, because the policy is not\nretroactive.\n\nTesting the organization policy\n-------------------------------\n\nNow that the organization policy is in effect, you cannot create resources in\nregions that were not specified as part of the organization policy. To test\nthis, try to create a regional persistent disk in an invalid location:\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. Select the Project you created above.\n\n3. Click **Create Disk**.\n\n4. Specify a **Name** for your disk.\n\n5. Select **Replicate this disk within region**.\n\n6. Under **Region** , select `europe-north1 (Finland)`.\n\n7. Under **Zones** , select `europe-north1-a` and `europe-north1-b`.\n\n8. Click **Create**.\n\nA red exclamation point appears next to the name, and an error notification\ndisplays: \n\n```\nLocation ZONE:europe-north1-a violates constraint\nconstraints/gcp.resourceLocations on the resource RESOURCE_ID\n```\n\nWhere \u003cvar translate=\"no\"\u003eRESOURCE_ID\u003c/var\u003e is the full resource path of your Project and disk.\nThe disk is not created.\n\nCreate regional persistent disk in valid location\n-------------------------------------------------\n\nThe organization policy constraint blocks the creation of resources unless you\nspecify a valid location:\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. Select the Project you created previously.\n\n3. Click **Create Disk**.\n\n4. Specify a **Name** for your disk.\n\n5. Select **Replicate this disk within region**.\n\n6. Under **Region** , select `asia-east2 (Hong Kong)`.\n\n7. Under **Zones** , select `asia-east2-a` and `asia-east2-b`.\n\n8. Click **Create**.\n\nThe resource is created successfully because all zones under `asia-east2` are\nwithin the `asia-locations` value group.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n### Delete regional persistent disks\n\nDelete the regional persistent disks you created for this quickstart:\n\n1. In the Google Cloud console, go to the **Disks** page.\n\n [Go to Disks](https://console.cloud.google.com/compute/disks)\n2. In the list that appears, select both of the disks that you created.\n\n3. To the right of the **Create Disk** button, click **Delete**.\n\n4. In the confirmation dialog that appears, click **Delete**.\n\nA notification dialog appears to confirm the disks were deleted.\n\n### Delete the Project\n\nDelete the Project you created for this quickstart:\n\n1. In the Google Cloud console, go to the **Manage resources** page.\n\n [Go to Manage resources](https://console.cloud.google.com/cloud-resource-manager)\n2. In the drop-down at the top of the page, select the Organization in which\n you created the quickstart Project.\n\n3. In the list of Project resources that appears, select the Project that you\n created, then click **Delete**.\n\n4. On the **Shut down project** dialog that appears, enter the Project ID,\n and then click **Shut down**.\n\nWhat's next\n-----------\n\n- Learn more about [creating and managing organization policies](/resource-manager/docs/organization-policy/creating-managing-policies).\n- Review the [services that support the resource locations constraint](/resource-manager/docs/organization-policy/defining-locations-supported-services)."]]