Organization policy constraints for Cloud Load Balancing

This page provides supplemental information about organization policy constraints that apply to Cloud Load Balancing. Use organization policy constraints to enforce load balancer settings across an entire project, folder, or organization.

Use an organization policy to restrict the Cloud Load Balancing types that can be created in your organization. Set the following organization policy constraint:


When you set the compute.restrictLoadBalancerCreationForTypes constraint, you specify the Cloud Load Balancing types that are disallowed. For a list of available types, see Restrict load balancer creation.

Setting up an organization policy


To set the Cloud Load Balancing organization policy from the console, complete the following steps:

  1. In the Google Cloud Console, go to the Organization policies page.

    Go to the Organization policies page

  2. In the Filter field, type load and select constraints/compute.restrictLoadBalancerCreationForTypes.
  3. Click Restrict Load Balancer Creation Based on Load Balancer Types.
  4. Click Edit to edit your existing Cloud Load Balancing policy constraints.
  5. To create a custom policy, select Customize.
  6. After making any changes, click Save to apply the constraint settings.


To set the OS Login organization policy, use the gcloud resource-manager org-policies enable-enforce command.

  1. Find your organization ID.

    gcloud organizations list
  2. Create the policy file, as shown in the following examples.

    List the values to be denied

     "constraint": "constraints/compute.restrictLoadBalancerCreationForTypes",
     "listPolicy": {
       "deniedValues": [

    Deny all external load balancers

     "constraint": "constraints/compute.restrictLoadBalancerCreationForTypes",
     "listPolicy": {
       "deniedValues": [

    Deny all load balancers

      "constraint": "constraints/compute.restrictLoadBalancerCreationForTypes",
      "listPolicy": {
        "allValues": "DENY"
  3. Set the constraint in your organization. Replace ORGANIZATION_ID with your organization ID.

    gcloud resource-manager org-policies set-policy POLICY_FILE \

    You can also apply the OS Login organization policy to a folder or a project with the --folder or the --project flags, and the folder ID and project ID, respectively.

    For folders, run the following command:

    gcloud resource-manager org-policies set-policy POLICY_FILE \

    For projects, run the following command:

    gcloud resource-manager org-policies set-policy POLICY_FILE \

    Replace the following:

After you set the policy, the policy is enforced when adding the respective Google Cloud forwarding rules.

The constraint is not enforced on existing Cloud Load Balancing configurations.

If you attempt to create Cloud Load Balancing of a type that violates the constraint, the attempt fails and an error message is generated. The error message has the following format:

Constraint constraints/compute.restrictLoadBalancerCreationForTypes
violated for projects/PROJECT_NAME. Forwarding Rule projects/PROJECT_NAME/region/REGION/forwardingRules/FORWARDING_RULE_NAME
of type SCHEME is not allowed.

If you set multiple restrictLoadBalancerCreationForTypes constraints at different resource levels, they are enforced hierarchically. For this reason, we recommended that you set the inheritFromParent field to true, which ensures that policies at higher layers are also considered.

To learn more about setting organization policies, including descriptions of the available options, see Creating and managing organization policies and Using constraints.

GKE error messages

If you are using Google Kubernetes Engine (GKE) Service and Ingress objects, using this org policy to restrict load balancer creation results in an error message similar to the following:

Warning  Sync    28s   loadbalancer-controller  Error during sync: error running
load balancer syncing routine: loadbalancer FORWARDING_RULE_NAME
does not exist: googleapi: Error 412:
Constraint constraints/compute.restrictLoadBalancerCreationForTypes violated for
projects/PROJECT_ID. Forwarding Rule
of type LOAD_BALANCER_TYPE is not allowed, conditionNotMet

You can view GKE error messages by running the following commands:

kubectl get events -w
kubectl describe RESOURCE_KIND NAME

Replace the following:

  • RESOURCE_KIND: the kind of load balancer, ingress or service
  • NAME: the name of the load balancer

What's next