Organization policy constraints

Available constraints

You can specify policies that use the following constraints. More constraints are under development.

Constraints supported by multiple Google Cloud services

Constraint Description Supported Prefixes
Google Cloud Platform - Resource Location Restriction This list constraint defines the set of locations where location-based GCP resources can be created.
By default, resources can be created in any location.
Policies for this constraint can specify multi-regions such as asia and europe, regions such as us-east1 or europe-west1 as allowed or denied locations. Allowing or denying a multi-region does not imply that all included sub-locations should also be allowed or denied. For example, if the policy denies the us multiregion, resources can still be created in the regional location us-east1.
We recommend using value groups to define your policy.
You can specify value groups, collections of locations that are curated by Google to provide a simple way to define your resource locations. To use value groups in your organization policy, prefix your entries with the string in:, followed by the value group.
For example, to create resources that will only be physically located within the US, set in:us-locations in the list of allowed values.
If the suggested_value field is used in a location policy, it should be a region. If the value specified is a region, a UI for a zonal resource may pre-populate any zone in that region.
constraints/gcp.resourceLocations
"is:", "in:"
Restrict allowed Google Cloud APIs and services This list constraint restricts the set of services and their APIs that can be enabled on this resource. By default, all services are allowed.
The denied list of services must come from the list below. Explicitly enabling APIs via this constraint is not currently supported. Specifying an API not in this list will result in an error.
Enforcement of this constraint is not retroactive. If a service is already enabled on a resource when this constraint is enforced, it will remain enabled.

constraints/serviceuser.services
"is:"

Constraints for specific services

Service(s) Constraint Description Supported Prefixes
App Engine Disable Source Code Download Disables code downloads of source code previously uploaded to App Engine.
constraints/appengine.disableCodeDownload
"is:"
Cloud Functions Allowed ingress settings (Cloud Functions) This list constraint defines the allowed ingress settings for deployment of a Cloud Function. When this constraint is enforced, functions will be required to have ingress settings that match one of the allowed values.
By default, Cloud Functions can use any ingress settings.
Ingress settings must be specified in the allowed list using the values of the IngressSettings enum.

constraints/cloudfunctions.allowedIngressSettings
"is:"
Allowed VPC Connector egress settings (Cloud Functions) This list constraint defines the allowed VPC Connector egress settings for deployment of a Cloud Function. When this constraint is enforced, functions will be required to have VPC Connector egress settings that match one of the allowed values.
By default, Cloud Functions can use any VPC Connector egress settings.
VPC Connector egress settings must be specified in the allowed list using the values of the VpcConnectorEgressSettings enum.

constraints/cloudfunctions.allowedVpcConnectorEgressSettings
"is:"
Require VPC Connector (Cloud Functions) This boolean constraint enforces setting a VPC Connector when deploying a Cloud Function. When this constraint is enforced, functions will be required to specify a VPC Connector.
By default, specifying a VPC Connector is not required to deploy a Cloud Function.

constraints/cloudfunctions.requireVPCConnector
"is:"
Cloud SQL Restrict default Google-managed encryption on Cloud SQL instances BETA: This boolean constraint, when set to True, requires all newly created, restarted, or updated Cloud SQL instances to use customer-managed encryption keys (CMEK). It is not retroactive (meaning existing instances with Google-managed encryption are not impacted unless they are updated or refreshed).
By default, this constraint is set to False and Google-managed encryption is allowed for Cloud SQL instances.

constraints/sql.disableDefaultEncryptionCreation
"is:"
Restrict Authorized Networks on Cloud SQL instances This boolean constraint restricts adding Authorized Networks for unproxied database access to Cloud SQL instances where this constraint is set to True. This constraint is not retroactive, Cloud SQL instances with existing Authorized Networks will still work even after this constraint is enforced.
By default, Authorized Networks can be added to Cloud SQL instances.

constraints/sql.restrictAuthorizedNetworks
"is:"
Restrict Public IP access on Cloud SQL instances This boolean constraint restricts configuring Public IP on Cloud SQL instances where this constraint is set to True. This constraint is not retroactive, Cloud SQL instances with existing Public IP access will still work even after this constraint is enforced.
By default, Public IP access is allowed to Cloud SQL instances.

constraints/sql.restrictPublicIp
"is:"
Compute Engine Disable Guest Attributes of Compute Engine metadata This boolean constraint disables Compute Engine API access to the Guest Attributes of Compute Engine VMs belonging to the organization, project, or folder where this constraint is set to True.
By default, the Compute Engine API can be used to access Compute Engine VM guest attributes.

constraints/compute.disableGuestAttributesAccess
"is:"
Disable Internet Network Endpoint Groups This boolean constraint restricts whether a user can create Internet Network Endpoint Groups (NEG) with a type of INTERNET_FQDN_PORT and INTERNET_IP_PORT.
By default, any user with appropriate IAM permissions can create Internet NEGs in any project.
constraints/compute.disableInternetNetworkEndpointGroup
"is:"
Disable VM nested virtualization This boolean constraint disables hardware-accelerated nested virtualization for all Compute Engine VMs belonging to the organization, project, or folder where this constraint is set to True.
By default, hardware-accelerated nested virtualization is allowed for all Compute Engine VMs running on Intel Haswell or newer CPU platforms.

constraints/compute.disableNestedVirtualization
"is:"
Disable VM serial port access This boolean constraint disables serial port access to Compute Engine VMs belonging to the organization, project, or folder where this constraint is set to True.
By default, customers can enable serial port access for Compute Engine VMs on a per-VM or per-project basis using metadata attributes. Enforcing this constraint will disable serial port access for Compute Engine VMs, regardless of the metadata attributes.

constraints/compute.disableSerialPortAccess
"is:"
Disable VM serial port logging to Stackdriver This boolean constraint disables serial port logging to Stackdriver from Compute Engine VMs belonging to the organization, project, or folder where this constraint is being enforced.
By default, serial port logging for Compute Engine VMs is disabled, and can be selectively enabled on a per-VM or per-project basis using metadata attributes. When enforced, this constraint disables serial port logging for new Compute Engine VMs whenever a new VM is created, as well as preventing users from changing the metadata attribute of any VMs (old or new) to True.
constraints/compute.disableSerialPortLogging
"is:"
Require OS Login This boolean constraint, when set to true, enables OS Login on all newly created Projects. All VM instances created in new projects will have OS Login enabled. On new and existing projects, this constraint prevents metadata updates that disable OS Login at the project or instance level.
By default, the OS Login feature is disabled on Compute Engine projects.
GKE instances do not currently support OS Login. If this constraint is applied to a Project, GKE instances running in that Project may not function properly.
constraints/compute.requireOsLogin
"is:"
Shielded VMs This boolean constraint, when set to True, requires that all new Compute Engine VM instances use Shielded disk images with Secure Boot, vTPM, and Integrity Monitoring options enabled. Secure Boot can be disabled after creation, if desired. Existing running instances will continue to work as usual.
By default, Shielded VM features do not need to be enabled in order to create Compute Engine VM instances. Shielded VM features add verifiable integrity and exfiltration resistance to your VMs.
constraints/compute.requireShieldedVm
"is:"
Restrict Cloud NAT usage This list constraint defines the set of subnetworks that are allowed to use Cloud NAT. By default, all subnetworks are allowed to use Cloud NAT. The allowed/denied list of subnetworks must be identified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, under:projects/PROJECT_ID, or projects/PROJECT_ID/regions/REGION_NAME/subnetworks/SUBNETWORK_NAME.
constraints/compute.restrictCloudNATUsage
"is:", "under:"
Restrict Dedicated Cloud Interconnect usage This list constraint defines the set of Compute Engine networks that are allowed to use Dedicated Cloud Interconnect. By default, networks are allowed to use any type of Cloud Interconnect. The allowed/denied list of networks must be identified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, under:projects/PROJECT_ID, or projects/PROJECT_ID/global/networks/NETWORK_NAME.
constraints/compute.restrictDedicatedInterconnectUsage
"is:", "under:"
Restrict Load Balancer Creation Based on Load Balancer Types This list constraint defines the set of load balancer types which can be created for an organization, folder, or project. Every load balancer type to be allowed or denied must be listed explicitly. By default, creation of all types of load balancers is allowed.
The list of allowed or denied values must be identified as the string name of a load balancer, and can only include values from the list below:
  • INTERNAL_TCP_UDP
  • INTERNAL_HTTP_HTTPS
  • EXTERNAL_NETWORK_TCP_UDP
  • EXTERNAL_TCP_PROXY
  • EXTERNAL_SSL_PROXY
  • EXTERNAL_HTTP_HTTPS

To include all internal or all external load balancer types, use the in: prefix followed by INTERNAL or EXTERNAL. For example, allowing in:INTERNAL will allow all load balancer types from the above list that include INTERNAL.
constraints/compute.restrictLoadBalancerCreationForTypes
"is:", "in:"
Restrict Partner Cloud Interconnect usage This list constraint defines the set of Compute Engine networks that are allowed to use Partner Cloud Interconnect. By default, networks are allowed to use any type of Cloud Interconnect. The allowed/denied list of networks must be identified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, under:projects/PROJECT_ID, or projects/PROJECT_ID/global/networks/NETWORK_NAME.
constraints/compute.restrictPartnerInterconnectUsage
"is:", "under:"
Restrict Protocol Forwarding Based on type of IP Address This list constraint defines the type of protocol forwarding rule objects with target instance that a user can create. When this constraint is enforced, new forwarding rule objects with target instance will be limited to internal and/or external IP addresses, based on the types specified. The types to be allowed or denied must be listed explicitly. By default, creation of both internal and external protocol forwarding rule objects with target instance are allowed.
The list of allowed or denied values can only include values from the list below:
  • INTERNAL
  • EXTERNAL
.
constraints/compute.restrictProtocolForwardingCreationForTypes
"is:"
Restrict Shared VPC Host Projects This list constraint defines the set of Shared VPC host projects that projects at or below this resource can attach to. By default, a project can attach to any host project in the same organization, thereby becoming a service project. Projects, folders, and organizations in allowed/denied lists affect all objects underneath them in the resource hierarchy, and must be specified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, or projects/PROJECT_ID.
constraints/compute.restrictSharedVpcHostProjects
"is:", "under:"
Restrict Shared VPC Subnetworks This list constraint defines the set of shared VPC subnetworks that eligible resources can use. This constraint does not apply to resources within the same project. By default, eligible resources can use any shared VPC subnetwork. The allowed/denied list of subnetworks must be specified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, under:projects/PROJECT_ID, or projects/PROJECT_ID/regions/REGION/subnetworks/SUBNETWORK-NAME.
constraints/compute.restrictSharedVpcSubnetworks
"is:", "under:"
Restrict VPC peering usage This list constraint defines the set of VPC networks that are allowed to be peered with the VPC networks belonging to this project, folder, or organization. By default, a Network Admin for one network can peer with any other network. The allowed/denied list of networks must be identified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, under:projects/PROJECT_ID, or projects/PROJECT_ID/global/networks/NETWORK_NAME.
This constraint is retroactive.
constraints/compute.restrictVpcPeering
"is:", "under:"
Restrict VPN Peer IPs This list constraint defines the set of valid IP-v4 addresses that can be configured as VPN peer IPs. By default, any IP can be a VPN peer IP for a VPC network. The allowed/denied list of IP addresses must be specified as valid IP-v4 addresses in the form: IP_V4_ADDRESS.
constraints/compute.restrictVpnPeerIPs
"is:"
Skip default network creation This boolean constraint skips the creation of the default network and related resources during Google Cloud Platform Project resource creation where this constraint is set to True. By default, a default network and supporting resources are automatically created when creating a Project resource.

constraints/compute.skipDefaultNetworkCreation
"is:"
Compute Storage resource use restrictions (Compute Engine disks, images, and snapshots) This list constraint defines a set of projects that are allowed to use Compute Engine's storage resources. By default, anyone with appropriate Cloud IAM permissions can access Compute Engine resources. When using this constraint, users must have Cloud IAM permissions, and they must not be restricted by the constraint to access the resource.
Projects, folders, and organizations specified in allowed or denied lists must be in the form: under:projects/PROJECT_ID, under:folders/FOLDER_ID, under:organizations/ORGANIZATION_ID.

constraints/compute.storageResourceUseRestrictions
"is:", "under:"
Define trusted image projects This list constraint defines the set of projects that can be used for image storage and disk instantiation for Compute Engine.
By default, instances can be created from images in any project that shares images publicly or explicitly with the user.
The allowed/denied list of publisher projects must be strings in the form: projects/PROJECT_ID. If this constraint is active, only images from trusted projects will be allowed as the source for boot disks for new instances.

constraints/compute.trustedImageProjects
"is:"
Restrict VM IP Forwarding This list constraint defines the set of VM instances that can enable IP forwarding. By default, any VM can enable IP forwarding in any virtual network. VM instances must be specified in the form: under:organizations/ORGANIZATION_ID, under:folders/FOLDER_ID, under:projects/PROJECT_ID, or projects/PROJECT_ID/zones/ZONE/instances/INSTANCE-NAME.
constraints/compute.vmCanIpForward
"is:", "under:"
Define allowed external IPs for VM instances This list constraint defines the set of Compute Engine VM instances that are allowed to use external IP addresses.
By default, all VM instances are allowed to use external IP addresses.
The allowed/denied list of VM instances must be identified by the VM instance name, in the form: projects/PROJECT_ID/zones/ZONE/instances/INSTANCE

constraints/compute.vmExternalIpAccess
"is:"
Cloud Healthcare Disable Cloud Logging Disables Cloud Logging in the organization, project, or folder where this constraint is enforced. Audit logs aren't affected by this constraint.
Logs generated before the constraint is enforced are not deleted and could still be accessed.
This constraint is only supported in Cloud Healthcare API.
constraints/gcp.disableCloudLogging
"is:"
Identity and Access Management Allow extending lifetime of OAuth 2.0 access tokens to up to 12 hours This list constraint defines the set of service accounts that can be granted OAuth 2.0 access tokens with a lifetime of up to 12 hours. By default, the maximum lifetime for these access tokens is 1 hour.
The allowed/denied list of service accounts must specify one or more service account email addresses.
constraints/iam.allowServiceAccountCredentialLifetimeExtension
"is:"
Domain restricted sharing This list constraint defines the set of members that can be added to Cloud IAM policies.
By default, all user identities are allowed to be added to Cloud IAM policies.
The allowed/denied list must specify one or more Cloud Identity or G Suite customer IDs. If this constraint is active, only identities in the allowed list will be eligible to be added to Cloud IAM policies.

constraints/iam.allowedPolicyMemberDomains
"is:"
Disable service account creation This boolean constraint disables the creation of service accounts where this constraint is set to `True`.
By default, service accounts can be created by users based on their Cloud IAM roles and permissions.

constraints/iam.disableServiceAccountCreation
"is:"
Disable service account key creation This boolean constraint disables the creation of service account external keys where this constraint is set to `True`.
By default, service account external keys can be created by users based on their Cloud IAM roles and permissions.

constraints/iam.disableServiceAccountKeyCreation
"is:"
Disable Service Account Key Upload This boolean constraint disables the feature that allows uploading public key to service account where this constraint is set to `True`.
By default, users can upload public key to service account based on their Cloud IAM roles and permissions.
constraints/iam.disableServiceAccountKeyUpload
"is:"
Disable Workload Identity Cluster Creation This boolean constraint, when set to `True`, requires that all new GKE clusters have Workload Identity disabled at creation time. Existing GKE clusters with Workload Identity already enabled will continue to work as usual. By default, Workload Identity can be enabled for any GKE cluster.
constraints/iam.disableWorkloadIdentityClusterCreation
"is:"
Resource Manager Restrict shared VPC project lien removal This boolean constraint restricts the set of users that can remove a Shared VPC project lien without organization-level permission where this constraint is set to True.
By default, any user with the permission to update liens can remove a Shared VPC project lien. Enforcing this constraint requires that permission be granted at the organization level.

constraints/compute.restrictXpnProjectLienRemoval
"is:"
Service Consumer Management Disable Automatic IAM Grants for Default Service Accounts This boolean constraint, when enforced, prevents the default App Engine and Compute Engine service accounts that are created in your projects from being automatically granted any IAM role on the project when the accounts are created.
By default, these service accounts automatically receive the Editor role when they are created.
constraints/iam.automaticIamGrantsForDefaultServiceAccounts
"is:"
Cloud Storage Google Cloud Platform - Detailed Audit Logging Mode When Detailed Audit Logging Mode is enforced, both the request and response are included in Cloud Audit Logs. Changes to this feature may take up to 10 minutes to reflect. This Org Policy is highly encouraged in coordination with Bucket Lock when seeking compliances such as SEC Rule 17a-4(f), CFTC Rule 1.31(c)-(d), and FINRA Rule 4511(c). This policy is currently only supported in Google Cloud Storage.
constraints/gcp.detailedAuditLoggingMode
"is:"
Retention policy duration in seconds This list constraint defines the set of durations for retention policies that can be set on Cloud Storage buckets.
By default, if no organization policy is specified, a Cloud Storage bucket can have a retention policy of any duration.
The list of allowed durations must be specified as a positive integer value greater than zero, representing the retention policy in seconds.
Any insert, update, or patch operation on a bucket in the organization resource must have a retention policy duration that matches the constraint.
Enforcement of this constraint is not retroactive. When a new organization policy is applied, the retention policy of existing buckets remain unchanged and valid.

constraints/storage.retentionPolicySeconds
"is:"
Enforce uniform bucket-level access This boolean constraint requires buckets to use uniform bucket-level access where this constraint is set to True. Any new bucket in the Organization resource must have uniform bucket-level access enabled, and no existing buckets in the organization resource can disable uniform bucket-level access.
Enforcement of this constraint is not retroactive: existing buckets with uniform bucket-level access disabled continue to have it disabled. The default value for this constraint is False.
Uniform bucket-level access disables the evaluation of ACLs assigned to Cloud Storage objects in the bucket. Consequently, only IAM policies grant access to objects in these buckets.

constraints/storage.uniformBucketLevelAccess
"is:"

How-to guides

For more information about how to use individual constraints:

Constraint How-to guide
constraints/cloudfunctions.allowedIngressSettings Using VPC Service Controls
constraints/compute.restrictCloudNATUsage Restrict Cloud NAT usage
constraints/compute.restrictLoadBalancerCreationForTypes Cloud Load Balancing constraints
constraints/compute.restrictProtocolForwardingCreationForTypes Protocol forwarding constraints
constraints/constraints/compute.restrictDedicatedInterconnectUsage
constraints/compute.restrictPartnerInterconnectUsage
Restricting Cloud Interconnect usage
constraints/compute.restrictVpnPeerIPs Restricting Peer IP addresses through a Cloud VPN tunnel
constraints/compute.trustedImageProjects Restricting access to images
constraints/compute.vmExternalIpAccess Disabling external IP access for VMs
constraints/iam.allowedPolicyMemberDomains Restricting identities by domain
constraints/iam.allowServiceAccountCredentialLifetimeExtension Extend lifetime of OAuth 2.0 access tokens
constraints/iam.disableServiceAccountCreation Restricting service account creation
constraints/iam.disableServiceAccountKeyCreation Restricting service account key creation
constraints/iam.disableServiceAccountKeyUpload Restricting service account key upload
constraints/iam.disableWorkloadIdentityClusterCreation Restricting workload identity cluster creation
constraints/gcp.detailedAuditLoggingMode
constraints/storage.retentionPolicySeconds
constraints/storage.uniformBucketLevelAccess
Organization policy constraints for Cloud Storage
constraints/gcp.disableCloudLogging Disabling Cloud Logging
constraints/gcp.resourceLocations Restricting Resource Locations
constraints/compute.restrictCloudNATUsage Setting Organization Policies in Cloud NAT

Learn more

To learn more about the core concepts of organization policy: