1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. orgpolicy
  5. CustomConstraint
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.orgpolicy.CustomConstraint

Explore with Pulumi AI

Custom constraints are created by administrators to provide more granular and customizable control over the specific fields that are restricted by your organization policies.

To get more information about CustomConstraint, see:

Example Usage

Org Policy Custom Constraint Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const constraint = new gcp.orgpolicy.CustomConstraint("constraint", {
    name: "custom.disableGkeAutoUpgrade",
    parent: "organizations/123456789",
    actionType: "ALLOW",
    condition: "resource.management.autoUpgrade == false",
    methodTypes: [
        "CREATE",
        "UPDATE",
    ],
    resourceTypes: ["container.googleapis.com/NodePool"],
});
Copy
import pulumi
import pulumi_gcp as gcp

constraint = gcp.orgpolicy.CustomConstraint("constraint",
    name="custom.disableGkeAutoUpgrade",
    parent="organizations/123456789",
    action_type="ALLOW",
    condition="resource.management.autoUpgrade == false",
    method_types=[
        "CREATE",
        "UPDATE",
    ],
    resource_types=["container.googleapis.com/NodePool"])
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/orgpolicy"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := orgpolicy.NewCustomConstraint(ctx, "constraint", &orgpolicy.CustomConstraintArgs{
			Name:       pulumi.String("custom.disableGkeAutoUpgrade"),
			Parent:     pulumi.String("organizations/123456789"),
			ActionType: pulumi.String("ALLOW"),
			Condition:  pulumi.String("resource.management.autoUpgrade == false"),
			MethodTypes: pulumi.StringArray{
				pulumi.String("CREATE"),
				pulumi.String("UPDATE"),
			},
			ResourceTypes: pulumi.StringArray{
				pulumi.String("container.googleapis.com/NodePool"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var constraint = new Gcp.OrgPolicy.CustomConstraint("constraint", new()
    {
        Name = "custom.disableGkeAutoUpgrade",
        Parent = "organizations/123456789",
        ActionType = "ALLOW",
        Condition = "resource.management.autoUpgrade == false",
        MethodTypes = new[]
        {
            "CREATE",
            "UPDATE",
        },
        ResourceTypes = new[]
        {
            "container.googleapis.com/NodePool",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.orgpolicy.CustomConstraint;
import com.pulumi.gcp.orgpolicy.CustomConstraintArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var constraint = new CustomConstraint("constraint", CustomConstraintArgs.builder()
            .name("custom.disableGkeAutoUpgrade")
            .parent("organizations/123456789")
            .actionType("ALLOW")
            .condition("resource.management.autoUpgrade == false")
            .methodTypes(            
                "CREATE",
                "UPDATE")
            .resourceTypes("container.googleapis.com/NodePool")
            .build());

    }
}
Copy
resources:
  constraint:
    type: gcp:orgpolicy:CustomConstraint
    properties:
      name: custom.disableGkeAutoUpgrade
      parent: organizations/123456789
      actionType: ALLOW
      condition: resource.management.autoUpgrade == false
      methodTypes:
        - CREATE
        - UPDATE
      resourceTypes:
        - container.googleapis.com/NodePool
Copy

Org Policy Custom Constraint Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const constraint = new gcp.orgpolicy.CustomConstraint("constraint", {
    name: "custom.disableGkeAutoUpgrade",
    parent: "organizations/123456789",
    displayName: "Disable GKE auto upgrade",
    description: "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced.",
    actionType: "ALLOW",
    condition: "resource.management.autoUpgrade == false",
    methodTypes: [
        "CREATE",
        "UPDATE",
    ],
    resourceTypes: ["container.googleapis.com/NodePool"],
});
const bool = new gcp.orgpolicy.Policy("bool", {
    name: pulumi.interpolate`organizations/123456789/policies/${constraint.name}`,
    parent: "organizations/123456789",
    spec: {
        rules: [{
            enforce: "TRUE",
        }],
    },
});
Copy
import pulumi
import pulumi_gcp as gcp

constraint = gcp.orgpolicy.CustomConstraint("constraint",
    name="custom.disableGkeAutoUpgrade",
    parent="organizations/123456789",
    display_name="Disable GKE auto upgrade",
    description="Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced.",
    action_type="ALLOW",
    condition="resource.management.autoUpgrade == false",
    method_types=[
        "CREATE",
        "UPDATE",
    ],
    resource_types=["container.googleapis.com/NodePool"])
bool = gcp.orgpolicy.Policy("bool",
    name=constraint.name.apply(lambda name: f"organizations/123456789/policies/{name}"),
    parent="organizations/123456789",
    spec={
        "rules": [{
            "enforce": "TRUE",
        }],
    })
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/orgpolicy"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		constraint, err := orgpolicy.NewCustomConstraint(ctx, "constraint", &orgpolicy.CustomConstraintArgs{
			Name:        pulumi.String("custom.disableGkeAutoUpgrade"),
			Parent:      pulumi.String("organizations/123456789"),
			DisplayName: pulumi.String("Disable GKE auto upgrade"),
			Description: pulumi.String("Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced."),
			ActionType:  pulumi.String("ALLOW"),
			Condition:   pulumi.String("resource.management.autoUpgrade == false"),
			MethodTypes: pulumi.StringArray{
				pulumi.String("CREATE"),
				pulumi.String("UPDATE"),
			},
			ResourceTypes: pulumi.StringArray{
				pulumi.String("container.googleapis.com/NodePool"),
			},
		})
		if err != nil {
			return err
		}
		_, err = orgpolicy.NewPolicy(ctx, "bool", &orgpolicy.PolicyArgs{
			Name: constraint.Name.ApplyT(func(name string) (string, error) {
				return fmt.Sprintf("organizations/123456789/policies/%v", name), nil
			}).(pulumi.StringOutput),
			Parent: pulumi.String("organizations/123456789"),
			Spec: &orgpolicy.PolicySpecArgs{
				Rules: orgpolicy.PolicySpecRuleArray{
					&orgpolicy.PolicySpecRuleArgs{
						Enforce: pulumi.String("TRUE"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var constraint = new Gcp.OrgPolicy.CustomConstraint("constraint", new()
    {
        Name = "custom.disableGkeAutoUpgrade",
        Parent = "organizations/123456789",
        DisplayName = "Disable GKE auto upgrade",
        Description = "Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced.",
        ActionType = "ALLOW",
        Condition = "resource.management.autoUpgrade == false",
        MethodTypes = new[]
        {
            "CREATE",
            "UPDATE",
        },
        ResourceTypes = new[]
        {
            "container.googleapis.com/NodePool",
        },
    });

    var @bool = new Gcp.OrgPolicy.Policy("bool", new()
    {
        Name = constraint.Name.Apply(name => $"organizations/123456789/policies/{name}"),
        Parent = "organizations/123456789",
        Spec = new Gcp.OrgPolicy.Inputs.PolicySpecArgs
        {
            Rules = new[]
            {
                new Gcp.OrgPolicy.Inputs.PolicySpecRuleArgs
                {
                    Enforce = "TRUE",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.orgpolicy.CustomConstraint;
import com.pulumi.gcp.orgpolicy.CustomConstraintArgs;
import com.pulumi.gcp.orgpolicy.Policy;
import com.pulumi.gcp.orgpolicy.PolicyArgs;
import com.pulumi.gcp.orgpolicy.inputs.PolicySpecArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var constraint = new CustomConstraint("constraint", CustomConstraintArgs.builder()
            .name("custom.disableGkeAutoUpgrade")
            .parent("organizations/123456789")
            .displayName("Disable GKE auto upgrade")
            .description("Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced.")
            .actionType("ALLOW")
            .condition("resource.management.autoUpgrade == false")
            .methodTypes(            
                "CREATE",
                "UPDATE")
            .resourceTypes("container.googleapis.com/NodePool")
            .build());

        var bool = new Policy("bool", PolicyArgs.builder()
            .name(constraint.name().applyValue(_name -> String.format("organizations/123456789/policies/%s", _name)))
            .parent("organizations/123456789")
            .spec(PolicySpecArgs.builder()
                .rules(PolicySpecRuleArgs.builder()
                    .enforce("TRUE")
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  constraint:
    type: gcp:orgpolicy:CustomConstraint
    properties:
      name: custom.disableGkeAutoUpgrade
      parent: organizations/123456789
      displayName: Disable GKE auto upgrade
      description: Only allow GKE NodePool resource to be created or updated if AutoUpgrade is not enabled where this custom constraint is enforced.
      actionType: ALLOW
      condition: resource.management.autoUpgrade == false
      methodTypes:
        - CREATE
        - UPDATE
      resourceTypes:
        - container.googleapis.com/NodePool
  bool:
    type: gcp:orgpolicy:Policy
    properties:
      name: organizations/123456789/policies/${constraint.name}
      parent: organizations/123456789
      spec:
        rules:
          - enforce: TRUE
Copy

Create CustomConstraint Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new CustomConstraint(name: string, args: CustomConstraintArgs, opts?: CustomResourceOptions);
@overload
def CustomConstraint(resource_name: str,
                     args: CustomConstraintArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def CustomConstraint(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     action_type: Optional[str] = None,
                     condition: Optional[str] = None,
                     method_types: Optional[Sequence[str]] = None,
                     parent: Optional[str] = None,
                     resource_types: Optional[Sequence[str]] = None,
                     description: Optional[str] = None,
                     display_name: Optional[str] = None,
                     name: Optional[str] = None)
func NewCustomConstraint(ctx *Context, name string, args CustomConstraintArgs, opts ...ResourceOption) (*CustomConstraint, error)
public CustomConstraint(string name, CustomConstraintArgs args, CustomResourceOptions? opts = null)
public CustomConstraint(String name, CustomConstraintArgs args)
public CustomConstraint(String name, CustomConstraintArgs args, CustomResourceOptions options)
type: gcp:orgpolicy:CustomConstraint
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CustomConstraintArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CustomConstraintArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CustomConstraintArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CustomConstraintArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CustomConstraintArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var customConstraintResource = new Gcp.OrgPolicy.CustomConstraint("customConstraintResource", new()
{
    ActionType = "string",
    Condition = "string",
    MethodTypes = new[]
    {
        "string",
    },
    Parent = "string",
    ResourceTypes = new[]
    {
        "string",
    },
    Description = "string",
    DisplayName = "string",
    Name = "string",
});
Copy
example, err := orgpolicy.NewCustomConstraint(ctx, "customConstraintResource", &orgpolicy.CustomConstraintArgs{
	ActionType: pulumi.String("string"),
	Condition:  pulumi.String("string"),
	MethodTypes: pulumi.StringArray{
		pulumi.String("string"),
	},
	Parent: pulumi.String("string"),
	ResourceTypes: pulumi.StringArray{
		pulumi.String("string"),
	},
	Description: pulumi.String("string"),
	DisplayName: pulumi.String("string"),
	Name:        pulumi.String("string"),
})
Copy
var customConstraintResource = new CustomConstraint("customConstraintResource", CustomConstraintArgs.builder()
    .actionType("string")
    .condition("string")
    .methodTypes("string")
    .parent("string")
    .resourceTypes("string")
    .description("string")
    .displayName("string")
    .name("string")
    .build());
Copy
custom_constraint_resource = gcp.orgpolicy.CustomConstraint("customConstraintResource",
    action_type="string",
    condition="string",
    method_types=["string"],
    parent="string",
    resource_types=["string"],
    description="string",
    display_name="string",
    name="string")
Copy
const customConstraintResource = new gcp.orgpolicy.CustomConstraint("customConstraintResource", {
    actionType: "string",
    condition: "string",
    methodTypes: ["string"],
    parent: "string",
    resourceTypes: ["string"],
    description: "string",
    displayName: "string",
    name: "string",
});
Copy
type: gcp:orgpolicy:CustomConstraint
properties:
    actionType: string
    condition: string
    description: string
    displayName: string
    methodTypes:
        - string
    name: string
    parent: string
    resourceTypes:
        - string
Copy

CustomConstraint Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The CustomConstraint resource accepts the following input properties:

ActionType This property is required. string
The action to take if the condition is met. Possible values are: ALLOW, DENY.
Condition This property is required. string
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
MethodTypes This property is required. List<string>
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
Parent
This property is required.
Changes to this property will trigger replacement.
string
The parent of the resource, an organization. Format should be organizations/{organization_id}.


ResourceTypes
This property is required.
Changes to this property will trigger replacement.
List<string>
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
Description string
A human-friendly description of the constraint to display as an error message when the policy is violated.
DisplayName string
A human-friendly name for the constraint.
Name Changes to this property will trigger replacement. string
Immutable. The name of the custom constraint. This is unique within the organization.
ActionType This property is required. string
The action to take if the condition is met. Possible values are: ALLOW, DENY.
Condition This property is required. string
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
MethodTypes This property is required. []string
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
Parent
This property is required.
Changes to this property will trigger replacement.
string
The parent of the resource, an organization. Format should be organizations/{organization_id}.


ResourceTypes
This property is required.
Changes to this property will trigger replacement.
[]string
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
Description string
A human-friendly description of the constraint to display as an error message when the policy is violated.
DisplayName string
A human-friendly name for the constraint.
Name Changes to this property will trigger replacement. string
Immutable. The name of the custom constraint. This is unique within the organization.
actionType This property is required. String
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition This property is required. String
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
methodTypes This property is required. List<String>
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
parent
This property is required.
Changes to this property will trigger replacement.
String
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resourceTypes
This property is required.
Changes to this property will trigger replacement.
List<String>
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
description String
A human-friendly description of the constraint to display as an error message when the policy is violated.
displayName String
A human-friendly name for the constraint.
name Changes to this property will trigger replacement. String
Immutable. The name of the custom constraint. This is unique within the organization.
actionType This property is required. string
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition This property is required. string
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
methodTypes This property is required. string[]
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
parent
This property is required.
Changes to this property will trigger replacement.
string
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resourceTypes
This property is required.
Changes to this property will trigger replacement.
string[]
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
description string
A human-friendly description of the constraint to display as an error message when the policy is violated.
displayName string
A human-friendly name for the constraint.
name Changes to this property will trigger replacement. string
Immutable. The name of the custom constraint. This is unique within the organization.
action_type This property is required. str
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition This property is required. str
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
method_types This property is required. Sequence[str]
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
parent
This property is required.
Changes to this property will trigger replacement.
str
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resource_types
This property is required.
Changes to this property will trigger replacement.
Sequence[str]
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
description str
A human-friendly description of the constraint to display as an error message when the policy is violated.
display_name str
A human-friendly name for the constraint.
name Changes to this property will trigger replacement. str
Immutable. The name of the custom constraint. This is unique within the organization.
actionType This property is required. String
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition This property is required. String
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
methodTypes This property is required. List<String>
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
parent
This property is required.
Changes to this property will trigger replacement.
String
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resourceTypes
This property is required.
Changes to this property will trigger replacement.
List<String>
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
description String
A human-friendly description of the constraint to display as an error message when the policy is violated.
displayName String
A human-friendly name for the constraint.
name Changes to this property will trigger replacement. String
Immutable. The name of the custom constraint. This is unique within the organization.

Outputs

All input properties are implicitly available as output properties. Additionally, the CustomConstraint resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
UpdateTime string
Output only. The timestamp representing when the constraint was last updated.
Id string
The provider-assigned unique ID for this managed resource.
UpdateTime string
Output only. The timestamp representing when the constraint was last updated.
id String
The provider-assigned unique ID for this managed resource.
updateTime String
Output only. The timestamp representing when the constraint was last updated.
id string
The provider-assigned unique ID for this managed resource.
updateTime string
Output only. The timestamp representing when the constraint was last updated.
id str
The provider-assigned unique ID for this managed resource.
update_time str
Output only. The timestamp representing when the constraint was last updated.
id String
The provider-assigned unique ID for this managed resource.
updateTime String
Output only. The timestamp representing when the constraint was last updated.

Look up Existing CustomConstraint Resource

Get an existing CustomConstraint resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: CustomConstraintState, opts?: CustomResourceOptions): CustomConstraint
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        action_type: Optional[str] = None,
        condition: Optional[str] = None,
        description: Optional[str] = None,
        display_name: Optional[str] = None,
        method_types: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        parent: Optional[str] = None,
        resource_types: Optional[Sequence[str]] = None,
        update_time: Optional[str] = None) -> CustomConstraint
func GetCustomConstraint(ctx *Context, name string, id IDInput, state *CustomConstraintState, opts ...ResourceOption) (*CustomConstraint, error)
public static CustomConstraint Get(string name, Input<string> id, CustomConstraintState? state, CustomResourceOptions? opts = null)
public static CustomConstraint get(String name, Output<String> id, CustomConstraintState state, CustomResourceOptions options)
resources:  _:    type: gcp:orgpolicy:CustomConstraint    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ActionType string
The action to take if the condition is met. Possible values are: ALLOW, DENY.
Condition string
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
Description string
A human-friendly description of the constraint to display as an error message when the policy is violated.
DisplayName string
A human-friendly name for the constraint.
MethodTypes List<string>
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
Name Changes to this property will trigger replacement. string
Immutable. The name of the custom constraint. This is unique within the organization.
Parent Changes to this property will trigger replacement. string
The parent of the resource, an organization. Format should be organizations/{organization_id}.


ResourceTypes Changes to this property will trigger replacement. List<string>
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
UpdateTime string
Output only. The timestamp representing when the constraint was last updated.
ActionType string
The action to take if the condition is met. Possible values are: ALLOW, DENY.
Condition string
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
Description string
A human-friendly description of the constraint to display as an error message when the policy is violated.
DisplayName string
A human-friendly name for the constraint.
MethodTypes []string
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
Name Changes to this property will trigger replacement. string
Immutable. The name of the custom constraint. This is unique within the organization.
Parent Changes to this property will trigger replacement. string
The parent of the resource, an organization. Format should be organizations/{organization_id}.


ResourceTypes Changes to this property will trigger replacement. []string
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
UpdateTime string
Output only. The timestamp representing when the constraint was last updated.
actionType String
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition String
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
description String
A human-friendly description of the constraint to display as an error message when the policy is violated.
displayName String
A human-friendly name for the constraint.
methodTypes List<String>
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
name Changes to this property will trigger replacement. String
Immutable. The name of the custom constraint. This is unique within the organization.
parent Changes to this property will trigger replacement. String
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resourceTypes Changes to this property will trigger replacement. List<String>
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
updateTime String
Output only. The timestamp representing when the constraint was last updated.
actionType string
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition string
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
description string
A human-friendly description of the constraint to display as an error message when the policy is violated.
displayName string
A human-friendly name for the constraint.
methodTypes string[]
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
name Changes to this property will trigger replacement. string
Immutable. The name of the custom constraint. This is unique within the organization.
parent Changes to this property will trigger replacement. string
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resourceTypes Changes to this property will trigger replacement. string[]
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
updateTime string
Output only. The timestamp representing when the constraint was last updated.
action_type str
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition str
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
description str
A human-friendly description of the constraint to display as an error message when the policy is violated.
display_name str
A human-friendly name for the constraint.
method_types Sequence[str]
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
name Changes to this property will trigger replacement. str
Immutable. The name of the custom constraint. This is unique within the organization.
parent Changes to this property will trigger replacement. str
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resource_types Changes to this property will trigger replacement. Sequence[str]
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
update_time str
Output only. The timestamp representing when the constraint was last updated.
actionType String
The action to take if the condition is met. Possible values are: ALLOW, DENY.
condition String
A CEL condition that refers to a supported service resource, for example resource.management.autoUpgrade == false. For details about CEL usage, see Common Expression Language.
description String
A human-friendly description of the constraint to display as an error message when the policy is violated.
displayName String
A human-friendly name for the constraint.
methodTypes List<String>
A list of RESTful methods for which to enforce the constraint. Can be CREATE, UPDATE, or both. Not all Google Cloud services support both methods. To see supported methods for each service, find the service in Supported services.
name Changes to this property will trigger replacement. String
Immutable. The name of the custom constraint. This is unique within the organization.
parent Changes to this property will trigger replacement. String
The parent of the resource, an organization. Format should be organizations/{organization_id}.


resourceTypes Changes to this property will trigger replacement. List<String>
Immutable. The fully qualified name of the Google Cloud REST resource containing the object and field you want to restrict. For example, container.googleapis.com/NodePool.
updateTime String
Output only. The timestamp representing when the constraint was last updated.

Import

CustomConstraint can be imported using any of these accepted formats:

  • {{parent}}/customConstraints/{{name}}

When using the pulumi import command, CustomConstraint can be imported using one of the formats above. For example:

$ pulumi import gcp:orgpolicy/customConstraint:CustomConstraint default {{parent}}/customConstraints/{{name}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.