This package is deprecated. Active development has stopped. We recommend using the Google Cloud package instead.
published on Wednesday, Nov 29, 2023 by Pulumi
This package is deprecated. Active development has stopped. We recommend using the Google Cloud package instead.
published on Wednesday, Nov 29, 2023 by Pulumi
Creates a custom constraint. Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the organization does not exist. Returns a google.rpc.Status with google.rpc.Code.ALREADY_EXISTS if the constraint already exists on the given organization.
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,
organization_id: Optional[str] = None,
action_type: Optional[CustomConstraintActionType] = None,
condition: Optional[str] = None,
description: Optional[str] = None,
display_name: Optional[str] = None,
method_types: Optional[Sequence[CustomConstraintMethodTypesItem]] = None,
name: Optional[str] = None,
resource_types: Optional[Sequence[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: google-native:orgpolicy/v2:CustomConstraint
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "google-native_orgpolicy_v2_custom_constraint" "name" {
# resource properties
}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 GoogleNative.Orgpolicy.V2.CustomConstraint("customConstraintResource", new()
{
OrganizationId = "string",
ActionType = GoogleNative.Orgpolicy.V2.CustomConstraintActionType.ActionTypeUnspecified,
Condition = "string",
Description = "string",
DisplayName = "string",
MethodTypes = new[]
{
GoogleNative.Orgpolicy.V2.CustomConstraintMethodTypesItem.MethodTypeUnspecified,
},
Name = "string",
ResourceTypes = new[]
{
"string",
},
});
example, err := orgpolicy.NewCustomConstraint(ctx, "customConstraintResource", &orgpolicy.CustomConstraintArgs{
OrganizationId: pulumi.String("string"),
ActionType: orgpolicy.CustomConstraintActionTypeActionTypeUnspecified,
Condition: pulumi.String("string"),
Description: pulumi.String("string"),
DisplayName: pulumi.String("string"),
MethodTypes: orgpolicy.CustomConstraintMethodTypesItemArray{
orgpolicy.CustomConstraintMethodTypesItemMethodTypeUnspecified,
},
Name: pulumi.String("string"),
ResourceTypes: pulumi.StringArray{
pulumi.String("string"),
},
})
resource "google-native_orgpolicy_v2_custom_constraint" "customConstraintResource" {
lifecycle {
create_before_destroy = true
}
organization_id = "string"
action_type = "ACTION_TYPE_UNSPECIFIED"
condition = "string"
description = "string"
display_name = "string"
method_types = ["METHOD_TYPE_UNSPECIFIED"]
name = "string"
resource_types = ["string"]
}
var customConstraintResource = new CustomConstraint("customConstraintResource", CustomConstraintArgs.builder()
.organizationId("string")
.actionType(com.pulumi.googlenative.orgpolicy_v2.enums.CustomConstraintActionType.ActionTypeUnspecified)
.condition("string")
.description("string")
.displayName("string")
.methodTypes("METHOD_TYPE_UNSPECIFIED")
.name("string")
.resourceTypes("string")
.build());
custom_constraint_resource = google_native.orgpolicy.v2.CustomConstraint("customConstraintResource",
organization_id="string",
action_type=google_native.orgpolicy.v2.CustomConstraintActionType.ACTION_TYPE_UNSPECIFIED,
condition="string",
description="string",
display_name="string",
method_types=[google_native.orgpolicy.v2.CustomConstraintMethodTypesItem.METHOD_TYPE_UNSPECIFIED],
name="string",
resource_types=["string"])
const customConstraintResource = new google_native.orgpolicy.v2.CustomConstraint("customConstraintResource", {
organizationId: "string",
actionType: google_native.orgpolicy.v2.CustomConstraintActionType.ActionTypeUnspecified,
condition: "string",
description: "string",
displayName: "string",
methodTypes: [google_native.orgpolicy.v2.CustomConstraintMethodTypesItem.MethodTypeUnspecified],
name: "string",
resourceTypes: ["string"],
});
type: google-native:orgpolicy/v2:CustomConstraint
properties:
actionType: ACTION_TYPE_UNSPECIFIED
condition: string
description: string
displayName: string
methodTypes:
- METHOD_TYPE_UNSPECIFIED
name: string
organizationId: 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
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:
- Organization
Id string - Action
Type Pulumi.Google Native. Orgpolicy. V2. Custom Constraint Action Type - Allow or deny type.
- Condition string
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - Description string
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- Display
Name string - One line display name for the UI. The max length of the display_name is 200 characters.
- Method
Types List<Pulumi.Google Native. Orgpolicy. V2. Custom Constraint Method Types Item> - All the operations being applied for this constraint.
- Name string
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - Resource
Types List<string> - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
- Organization
Id string - Action
Type CustomConstraint Action Type - Allow or deny type.
- Condition string
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - Description string
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- Display
Name string - One line display name for the UI. The max length of the display_name is 200 characters.
- Method
Types []CustomConstraint Method Types Item - All the operations being applied for this constraint.
- Name string
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - Resource
Types []string - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
- organization_
id string - action_
type "ACTION_TYPE_UNSPECIFIED" | "ALLOW" | "DENY" - Allow or deny type.
- condition string
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - description string
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- display_
name string - One line display name for the UI. The max length of the display_name is 200 characters.
- method_
types list("METHOD_TYPE_UNSPECIFIED" | "CREATE" | "UPDATE" | "DELETE") - All the operations being applied for this constraint.
- name string
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - resource_
types list(string) - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
- organization
Id String - action
Type CustomConstraint Action Type - Allow or deny type.
- condition String
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - description String
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- display
Name String - One line display name for the UI. The max length of the display_name is 200 characters.
- method
Types List<CustomConstraint Method Types Item> - All the operations being applied for this constraint.
- name String
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - resource
Types List<String> - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
- organization
Id string - action
Type CustomConstraint Action Type - Allow or deny type.
- condition string
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - description string
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- display
Name string - One line display name for the UI. The max length of the display_name is 200 characters.
- method
Types CustomConstraint Method Types Item[] - All the operations being applied for this constraint.
- name string
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - resource
Types string[] - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
- organization_
id str - action_
type CustomConstraint Action Type - Allow or deny type.
- condition str
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - description str
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- display_
name str - One line display name for the UI. The max length of the display_name is 200 characters.
- method_
types Sequence[CustomConstraint Method Types Item] - All the operations being applied for this constraint.
- name str
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - resource_
types Sequence[str] - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
- organization
Id String - action
Type "ACTION_TYPE_UNSPECIFIED" | "ALLOW" | "DENY" - Allow or deny type.
- condition String
- Org policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")or,resource.management.auto_upgrade == trueThe max length of the condition is 1000 characters. - description String
- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
- display
Name String - One line display name for the UI. The max length of the display_name is 200 characters.
- method
Types List<"METHOD_TYPE_UNSPECIFIED" | "CREATE" | "UPDATE" | "DELETE"> - All the operations being applied for this constraint.
- name String
- Immutable. Name of the constraint. This is unique within the organization. Format of the name should be *
organizations/{organization_id}/customConstraints/{custom_constraint_id}Example:organizations/123/customConstraints/custom.createOnlyE2TypeVmsThe max length is 70 characters and the minimum length is 1. Note that the prefixorganizations/{organization_id}/customConstraints/is not counted. - resource
Types List<String> - Immutable. The resource instance type on which this policy applies. Format will be of the form :
/Example: *compute.googleapis.com/Instance.
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.
- Update
Time string - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
- Id string
- The provider-assigned unique ID for this managed resource.
- Update
Time string - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
- id string
- The provider-assigned unique ID for this managed resource.
- update_
time string - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
- id String
- The provider-assigned unique ID for this managed resource.
- update
Time String - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
- id string
- The provider-assigned unique ID for this managed resource.
- update
Time string - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
- id str
- The provider-assigned unique ID for this managed resource.
- update_
time str - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
- id String
- The provider-assigned unique ID for this managed resource.
- update
Time String - The last time this custom constraint was updated. This represents the last time that the
CreateCustomConstraintorUpdateCustomConstraintRPC was called
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>, opts?: CustomResourceOptions): CustomConstraint@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None) -> CustomConstraintfunc GetCustomConstraint(ctx *Context, name string, id IDInput, state *CustomConstraintState, opts ...ResourceOption) (*CustomConstraint, error)public static CustomConstraint Get(string name, Input<string> id, CustomResourceOptions? opts = null)public static CustomConstraint get(String name, Output<String> id, CustomResourceOptions options)resources: existingCustomConstraint: type: google-native:orgpolicy/v2:CustomConstraint get: id: ${id}import {
to = google-native_orgpolicy_v2_custom_constraint.example
id = "${id}"
}
- name string
- The unique name of the resulting resource.
- id Input<ID>
- The unique provider ID of the resource to look up.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resulting resource.
- id str
- The unique provider ID of the resource to look up.
- 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 resulting resource.
- id IDInput
- The unique provider ID of the resource to look up.
- state CustomConstraintState
- Pass nil. This resource has no state arguments.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resulting resource.
- id Input<string>
- The unique provider ID of the resource to look up.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resulting resource.
- id Output<String>
- The unique provider ID of the resource to look up.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Supporting Types
CustomConstraintActionType
Allow or deny type.
| Name | Value | Description |
|---|---|---|
| Action | ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Allow | ALLOW | Allowed action type. |
| Deny | DENY | Deny action type. |
| Name | Value | Description |
|---|---|---|
| Custom | ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Custom | ALLOW | Allowed action type. |
| Custom | DENY | Deny action type. |
| Value | Description |
|---|---|
ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
ALLOW | Allowed action type. |
DENY | Deny action type. |
| Name | Value | Description |
|---|---|---|
| Action | ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Allow | ALLOW | Allowed action type. |
| Deny | DENY | Deny action type. |
| Name | Value | Description |
|---|---|---|
| Action | ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Allow | ALLOW | Allowed action type. |
| Deny | DENY | Deny action type. |
| Name | Value | Description |
|---|---|---|
| ACTION_TYPE_UNSPECIFIED | ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| ALLOW | ALLOW | Allowed action type. |
| DENY | DENY | Deny action type. |
| Value | Description |
|---|---|
ACTION_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
ALLOW | Allowed action type. |
DENY | Deny action type. |
CustomConstraintMethodTypesItem
| Name | Value | Description |
|---|---|---|
| Method | METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Create | CREATE | Constraint applied when creating the resource. |
| Update | UPDATE | Constraint applied when updating the resource. |
| Delete | DELETE | Constraint applied when deleting the resource. Not supported yet. |
| Name | Value | Description |
|---|---|---|
| Custom | METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Custom | CREATE | Constraint applied when creating the resource. |
| Custom | UPDATE | Constraint applied when updating the resource. |
| Custom | DELETE | Constraint applied when deleting the resource. Not supported yet. |
| Value | Description |
|---|---|
METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
CREATE | Constraint applied when creating the resource. |
UPDATE | Constraint applied when updating the resource. |
DELETE | Constraint applied when deleting the resource. Not supported yet. |
| Name | Value | Description |
|---|---|---|
| Method | METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Create | CREATE | Constraint applied when creating the resource. |
| Update | UPDATE | Constraint applied when updating the resource. |
| Delete | DELETE | Constraint applied when deleting the resource. Not supported yet. |
| Name | Value | Description |
|---|---|---|
| Method | METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| Create | CREATE | Constraint applied when creating the resource. |
| Update | UPDATE | Constraint applied when updating the resource. |
| Delete | DELETE | Constraint applied when deleting the resource. Not supported yet. |
| Name | Value | Description |
|---|---|---|
| METHOD_TYPE_UNSPECIFIED | METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
| CREATE | CREATE | Constraint applied when creating the resource. |
| UPDATE | UPDATE | Constraint applied when updating the resource. |
| DELETE | DELETE | Constraint applied when deleting the resource. Not supported yet. |
| Value | Description |
|---|---|
METHOD_TYPE_UNSPECIFIED | Unspecified. Results in an error. |
CREATE | Constraint applied when creating the resource. |
UPDATE | Constraint applied when updating the resource. |
DELETE | Constraint applied when deleting the resource. Not supported yet. |
Package Details
- Repository
- Google Cloud Native pulumi/pulumi-google-native
- License
- Apache-2.0
This package is deprecated. Active development has stopped. We recommend using the Google Cloud package instead.
published on Wednesday, Nov 29, 2023 by Pulumi