Stay organized with collections Save and categorize content based on your preferences.
Manage function resources using custom constraintsThis page provides supplemental information for setting custom constraints on functions created using gcloud functions
commands or the Cloud Functions v2 API.
If you've created or deployed functions using Cloud Run, see Cloud Run's Manage custom constraints for projects guide for a detailed description of how to use custom constraints.
LimitationsThe following limitations apply to using custom organization policies for Cloud Functions v2 API functions:
CREATE
method for Compute Engine resources.The following table provides the syntax of some custom organization policies that you might find useful:
Description Constraint syntax Prevent functions from being created with a specific languagename: organizations/ORGANIZATION_ID/customConstraints/custom.cloudFunctionRuntimeBlock resource_types: cloudfunctions.googleapis.com/Function method_types: - CREATE - UPDATE condition: resource.buildConfig.runtime == "python312" action_type: DENY display_name: Deny functions using Python 3.12 description: Functions cannot be created with Python 3.12 as the language runtimeRequire functions to use a specific worker pool
name: organizations/ORGANIZATION_ID/customConstraints/custom.cloudFunctionsWorkerPool resource_types: cloudfunctions.googleapis.com/Function method_types: - CREATE - UPDATE condition: resource.buildConfig.workerPool == "WORKER_POOL" action_type: DENY display_name: Require worker pool description: Functions must use a worker poolReplace WORKER_POOL with the name of your Cloud Build worker pool. Require that functions store all container images in a specific image repository
name: organizations/ORGANIZATION_ID/customConstraints/custom.cloudFunctionsRepository resource_types: cloudfunctions.googleapis.com/Function method_types: - CREATE - UPDATE condition: resource.buildConfig.dockerRepository.startsWith("REPO_PATH") action_type: DENY display_name: Image repository constraint description: Functions must push images to a central image repository under REPO_PATHReplace REPO_PATH with the URI of the image repository URL that you want all functions to store their container images in. 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-08-07 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-08-07 UTC."],[[["Organization administrators can create custom constraints for Cloud Run functions using Organization Policy, allowing for granular control over specific fields at the project, folder, or organization level."],["Custom constraints offer benefits like cost management, enforcing security requirements, and governing automation scripts by restricting VM instance types, requiring specific firewall rules, or verifying label expressions."],["Custom constraints are defined in YAML files specifying resources, methods, conditions (using Common Expression Language), and actions, and they can be enforced at the project level using the `gcloud` command-line tool or the Google Cloud console."],["Custom constraints are only enforced on Cloud Functions v2 APIs, not Cloud Run functions (1st gen), and are only applied to the `CREATE` method for Compute Engine resources."],["Custom organization policies can be set to deny the creation of functions with a specific language, require functions to use a specific worker pool, and require functions to store container images in a specific image repository."]]],[]]
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.4