1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. orgpolicy
  5. CustomConstraint
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

gcp.orgpolicy.CustomConstraint

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi

    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"],
    });
    
    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"])
    
    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
    	})
    }
    
    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",
            },
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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",
            }],
        },
    });
    
    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",
            }],
        })
    
    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
    	})
    }
    
    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",
                    },
                },
            },
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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 string
    The unique name of the resource.
    args CustomConstraintArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args CustomConstraintArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomConstraintArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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",
    });
    
    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"),
    })
    
    var customConstraintResource = new CustomConstraint("customConstraintResource", CustomConstraintArgs.builder()
        .actionType("string")
        .condition("string")
        .methodTypes("string")
        .parent("string")
        .resourceTypes("string")
        .description("string")
        .displayName("string")
        .name("string")
        .build());
    
    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")
    
    const customConstraintResource = new gcp.orgpolicy.CustomConstraint("customConstraintResource", {
        actionType: "string",
        condition: "string",
        methodTypes: ["string"],
        parent: "string",
        resourceTypes: ["string"],
        description: "string",
        displayName: "string",
        name: "string",
    });
    
    type: gcp:orgpolicy:CustomConstraint
    properties:
        actionType: string
        condition: string
        description: string
        displayName: string
        methodTypes:
            - string
        name: string
        parent: string
        resourceTypes:
            - string
    

    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

    The CustomConstraint resource accepts the following input properties:

    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.
    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.
    Parent string
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    ResourceTypes 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 string
    Immutable. The name of the custom constraint. This is unique within the organization.
    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.
    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.
    Parent string
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    ResourceTypes []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 string
    Immutable. The name of the custom constraint. This is unique within the organization.
    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.
    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.
    parent String
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resourceTypes 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 String
    Immutable. The name of the custom constraint. This is unique within the organization.
    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.
    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.
    parent string
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resourceTypes 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 string
    Immutable. The name of the custom constraint. This is unique within the organization.
    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.
    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.
    parent str
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resource_types 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 str
    Immutable. The name of the custom constraint. This is unique within the organization.
    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.
    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.
    parent String
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resourceTypes 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 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 string
    Immutable. The name of the custom constraint. This is unique within the organization.
    Parent string
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    ResourceTypes 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 string
    Immutable. The name of the custom constraint. This is unique within the organization.
    Parent string
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    ResourceTypes []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 String
    Immutable. The name of the custom constraint. This is unique within the organization.
    parent String
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resourceTypes 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 string
    Immutable. The name of the custom constraint. This is unique within the organization.
    parent string
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resourceTypes 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 str
    Immutable. The name of the custom constraint. This is unique within the organization.
    parent str
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resource_types 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 String
    Immutable. The name of the custom constraint. This is unique within the organization.
    parent String
    The parent of the resource, an organization. Format should be organizations/{organization_id}.


    resourceTypes 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}}
    

    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.
    gcp logo
    Google Cloud Classic v8.3.1 published on Wednesday, Sep 25, 2024 by Pulumi