published on Monday, May 18, 2026 by vmware
published on Monday, May 18, 2026 by vmware
Create PolicyConstraint Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PolicyConstraint(name: string, args: PolicyConstraintArgs, opts?: CustomResourceOptions);@overload
def PolicyConstraint(resource_name: str,
args: PolicyConstraintArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PolicyConstraint(resource_name: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
context: Optional[PolicyConstraintContextArgs] = None,
description: Optional[str] = None,
instance_counts: Optional[Sequence[PolicyConstraintInstanceCountArgs]] = None,
message: Optional[str] = None,
nsx_id: Optional[str] = None,
policy_constraint_id: Optional[str] = None,
tags: Optional[Sequence[PolicyConstraintTagArgs]] = None,
target_owner_type: Optional[str] = None,
targets: Optional[Sequence[PolicyConstraintTargetArgs]] = None)func NewPolicyConstraint(ctx *Context, name string, args PolicyConstraintArgs, opts ...ResourceOption) (*PolicyConstraint, error)public PolicyConstraint(string name, PolicyConstraintArgs args, CustomResourceOptions? opts = null)
public PolicyConstraint(String name, PolicyConstraintArgs args)
public PolicyConstraint(String name, PolicyConstraintArgs args, CustomResourceOptions options)
type: nsxt:PolicyConstraint
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "nsxt_policyconstraint" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args PolicyConstraintArgs
- 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 PolicyConstraintArgs
- 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 PolicyConstraintArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyConstraintArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyConstraintArgs
- 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 policyConstraintResource = new Nsxt.PolicyConstraint("policyConstraintResource", new()
{
DisplayName = "string",
Context = new Nsxt.Inputs.PolicyConstraintContextArgs
{
ProjectId = "string",
},
Description = "string",
InstanceCounts = new[]
{
new Nsxt.Inputs.PolicyConstraintInstanceCountArgs
{
Count = 0,
TargetResourceType = "string",
Operator = "string",
},
},
Message = "string",
NsxId = "string",
PolicyConstraintId = "string",
Tags = new[]
{
new Nsxt.Inputs.PolicyConstraintTagArgs
{
Scope = "string",
Tag = "string",
},
},
TargetOwnerType = "string",
Targets = new[]
{
new Nsxt.Inputs.PolicyConstraintTargetArgs
{
PathPrefix = "string",
},
},
});
example, err := nsxt.NewPolicyConstraint(ctx, "policyConstraintResource", &nsxt.PolicyConstraintArgs{
DisplayName: pulumi.String("string"),
Context: &nsxt.PolicyConstraintContextArgs{
ProjectId: pulumi.String("string"),
},
Description: pulumi.String("string"),
InstanceCounts: nsxt.PolicyConstraintInstanceCountArray{
&nsxt.PolicyConstraintInstanceCountArgs{
Count: pulumi.Float64(0),
TargetResourceType: pulumi.String("string"),
Operator: pulumi.String("string"),
},
},
Message: pulumi.String("string"),
NsxId: pulumi.String("string"),
PolicyConstraintId: pulumi.String("string"),
Tags: nsxt.PolicyConstraintTagArray{
&nsxt.PolicyConstraintTagArgs{
Scope: pulumi.String("string"),
Tag: pulumi.String("string"),
},
},
TargetOwnerType: pulumi.String("string"),
Targets: nsxt.PolicyConstraintTargetArray{
&nsxt.PolicyConstraintTargetArgs{
PathPrefix: pulumi.String("string"),
},
},
})
resource "nsxt_policyconstraint" "policyConstraintResource" {
display_name = "string"
context = {
project_id = "string"
}
description = "string"
instance_counts {
count = 0
target_resource_type = "string"
operator = "string"
}
message = "string"
nsx_id = "string"
policy_constraint_id = "string"
tags {
scope = "string"
tag = "string"
}
target_owner_type = "string"
targets {
path_prefix = "string"
}
}
var policyConstraintResource = new PolicyConstraint("policyConstraintResource", PolicyConstraintArgs.builder()
.displayName("string")
.context(PolicyConstraintContextArgs.builder()
.projectId("string")
.build())
.description("string")
.instanceCounts(PolicyConstraintInstanceCountArgs.builder()
.count(0.0)
.targetResourceType("string")
.operator("string")
.build())
.message("string")
.nsxId("string")
.policyConstraintId("string")
.tags(PolicyConstraintTagArgs.builder()
.scope("string")
.tag("string")
.build())
.targetOwnerType("string")
.targets(PolicyConstraintTargetArgs.builder()
.pathPrefix("string")
.build())
.build());
policy_constraint_resource = nsxt.PolicyConstraint("policyConstraintResource",
display_name="string",
context={
"project_id": "string",
},
description="string",
instance_counts=[{
"count": float(0),
"target_resource_type": "string",
"operator": "string",
}],
message="string",
nsx_id="string",
policy_constraint_id="string",
tags=[{
"scope": "string",
"tag": "string",
}],
target_owner_type="string",
targets=[{
"path_prefix": "string",
}])
const policyConstraintResource = new nsxt.PolicyConstraint("policyConstraintResource", {
displayName: "string",
context: {
projectId: "string",
},
description: "string",
instanceCounts: [{
count: 0,
targetResourceType: "string",
operator: "string",
}],
message: "string",
nsxId: "string",
policyConstraintId: "string",
tags: [{
scope: "string",
tag: "string",
}],
targetOwnerType: "string",
targets: [{
pathPrefix: "string",
}],
});
type: nsxt:PolicyConstraint
properties:
context:
projectId: string
description: string
displayName: string
instanceCounts:
- count: 0
operator: string
targetResourceType: string
message: string
nsxId: string
policyConstraintId: string
tags:
- scope: string
tag: string
targetOwnerType: string
targets:
- pathPrefix: string
PolicyConstraint 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 PolicyConstraint resource accepts the following input properties:
- Display
Name string - Display name of the resource.
- Context
Policy
Constraint Context - The context which the object belongs to
- Description string
- Description of the resource.
- Instance
Counts List<PolicyConstraint Instance Count> - Constraint details
- Message string
- User friendly message to be shown to users upon violation.
- Nsx
Id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- Policy
Constraint stringId - ID of the resource.
-
List<Policy
Constraint Tag> - A list of scope + tag pairs to associate with this resource.
- Target
Owner stringType - Targets
List<Policy
Constraint Target> - Targets for the constraints to be enforced
- Display
Name string - Display name of the resource.
- Context
Policy
Constraint Context Args - The context which the object belongs to
- Description string
- Description of the resource.
- Instance
Counts []PolicyConstraint Instance Count Args - Constraint details
- Message string
- User friendly message to be shown to users upon violation.
- Nsx
Id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- Policy
Constraint stringId - ID of the resource.
-
[]Policy
Constraint Tag Args - A list of scope + tag pairs to associate with this resource.
- Target
Owner stringType - Targets
[]Policy
Constraint Target Args - Targets for the constraints to be enforced
- display_
name string - Display name of the resource.
- context object
- The context which the object belongs to
- description string
- Description of the resource.
- instance_
counts list(object) - Constraint details
- message string
- User friendly message to be shown to users upon violation.
- nsx_
id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- policy_
constraint_ stringid - ID of the resource.
- list(object)
- A list of scope + tag pairs to associate with this resource.
- target_
owner_ stringtype - targets list(object)
- Targets for the constraints to be enforced
- display
Name String - Display name of the resource.
- context
Policy
Constraint Context - The context which the object belongs to
- description String
- Description of the resource.
- instance
Counts List<PolicyConstraint Instance Count> - Constraint details
- message String
- User friendly message to be shown to users upon violation.
- nsx
Id String - The NSX ID of this resource. If set, this ID will be used to create the resource.
- policy
Constraint StringId - ID of the resource.
-
List<Policy
Constraint Tag> - A list of scope + tag pairs to associate with this resource.
- target
Owner StringType - targets
List<Policy
Constraint Target> - Targets for the constraints to be enforced
- display
Name string - Display name of the resource.
- context
Policy
Constraint Context - The context which the object belongs to
- description string
- Description of the resource.
- instance
Counts PolicyConstraint Instance Count[] - Constraint details
- message string
- User friendly message to be shown to users upon violation.
- nsx
Id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- policy
Constraint stringId - ID of the resource.
-
Policy
Constraint Tag[] - A list of scope + tag pairs to associate with this resource.
- target
Owner stringType - targets
Policy
Constraint Target[] - Targets for the constraints to be enforced
- display_
name str - Display name of the resource.
- context
Policy
Constraint Context Args - The context which the object belongs to
- description str
- Description of the resource.
- instance_
counts Sequence[PolicyConstraint Instance Count Args] - Constraint details
- message str
- User friendly message to be shown to users upon violation.
- nsx_
id str - The NSX ID of this resource. If set, this ID will be used to create the resource.
- policy_
constraint_ strid - ID of the resource.
-
Sequence[Policy
Constraint Tag Args] - A list of scope + tag pairs to associate with this resource.
- target_
owner_ strtype - targets
Sequence[Policy
Constraint Target Args] - Targets for the constraints to be enforced
- display
Name String - Display name of the resource.
- context Property Map
- The context which the object belongs to
- description String
- Description of the resource.
- instance
Counts List<Property Map> - Constraint details
- message String
- User friendly message to be shown to users upon violation.
- nsx
Id String - The NSX ID of this resource. If set, this ID will be used to create the resource.
- policy
Constraint StringId - ID of the resource.
- List<Property Map>
- A list of scope + tag pairs to associate with this resource.
- target
Owner StringType - targets List<Property Map>
- Targets for the constraints to be enforced
Outputs
All input properties are implicitly available as output properties. Additionally, the PolicyConstraint resource produces the following output properties:
Look up Existing PolicyConstraint Resource
Get an existing PolicyConstraint 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?: PolicyConstraintState, opts?: CustomResourceOptions): PolicyConstraint@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
context: Optional[PolicyConstraintContextArgs] = None,
description: Optional[str] = None,
display_name: Optional[str] = None,
instance_counts: Optional[Sequence[PolicyConstraintInstanceCountArgs]] = None,
message: Optional[str] = None,
nsx_id: Optional[str] = None,
path: Optional[str] = None,
policy_constraint_id: Optional[str] = None,
revision: Optional[float] = None,
tags: Optional[Sequence[PolicyConstraintTagArgs]] = None,
target_owner_type: Optional[str] = None,
targets: Optional[Sequence[PolicyConstraintTargetArgs]] = None) -> PolicyConstraintfunc GetPolicyConstraint(ctx *Context, name string, id IDInput, state *PolicyConstraintState, opts ...ResourceOption) (*PolicyConstraint, error)public static PolicyConstraint Get(string name, Input<string> id, PolicyConstraintState? state, CustomResourceOptions? opts = null)public static PolicyConstraint get(String name, Output<String> id, PolicyConstraintState state, CustomResourceOptions options)resources: _: type: nsxt:PolicyConstraint get: id: ${id}import {
to = nsxt_policyconstraint.example
id = "${id}"
}
- 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.
- Context
Policy
Constraint Context - The context which the object belongs to
- Description string
- Description of the resource.
- Display
Name string - Display name of the resource.
- Instance
Counts List<PolicyConstraint Instance Count> - Constraint details
- Message string
- User friendly message to be shown to users upon violation.
- Nsx
Id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- Path string
- The NSX path of the policy resource.
- Policy
Constraint stringId - ID of the resource.
- Revision double
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
-
List<Policy
Constraint Tag> - A list of scope + tag pairs to associate with this resource.
- Target
Owner stringType - Targets
List<Policy
Constraint Target> - Targets for the constraints to be enforced
- Context
Policy
Constraint Context Args - The context which the object belongs to
- Description string
- Description of the resource.
- Display
Name string - Display name of the resource.
- Instance
Counts []PolicyConstraint Instance Count Args - Constraint details
- Message string
- User friendly message to be shown to users upon violation.
- Nsx
Id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- Path string
- The NSX path of the policy resource.
- Policy
Constraint stringId - ID of the resource.
- Revision float64
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
-
[]Policy
Constraint Tag Args - A list of scope + tag pairs to associate with this resource.
- Target
Owner stringType - Targets
[]Policy
Constraint Target Args - Targets for the constraints to be enforced
- context object
- The context which the object belongs to
- description string
- Description of the resource.
- display_
name string - Display name of the resource.
- instance_
counts list(object) - Constraint details
- message string
- User friendly message to be shown to users upon violation.
- nsx_
id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- path string
- The NSX path of the policy resource.
- policy_
constraint_ stringid - ID of the resource.
- revision number
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
- list(object)
- A list of scope + tag pairs to associate with this resource.
- target_
owner_ stringtype - targets list(object)
- Targets for the constraints to be enforced
- context
Policy
Constraint Context - The context which the object belongs to
- description String
- Description of the resource.
- display
Name String - Display name of the resource.
- instance
Counts List<PolicyConstraint Instance Count> - Constraint details
- message String
- User friendly message to be shown to users upon violation.
- nsx
Id String - The NSX ID of this resource. If set, this ID will be used to create the resource.
- path String
- The NSX path of the policy resource.
- policy
Constraint StringId - ID of the resource.
- revision Double
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
-
List<Policy
Constraint Tag> - A list of scope + tag pairs to associate with this resource.
- target
Owner StringType - targets
List<Policy
Constraint Target> - Targets for the constraints to be enforced
- context
Policy
Constraint Context - The context which the object belongs to
- description string
- Description of the resource.
- display
Name string - Display name of the resource.
- instance
Counts PolicyConstraint Instance Count[] - Constraint details
- message string
- User friendly message to be shown to users upon violation.
- nsx
Id string - The NSX ID of this resource. If set, this ID will be used to create the resource.
- path string
- The NSX path of the policy resource.
- policy
Constraint stringId - ID of the resource.
- revision number
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
-
Policy
Constraint Tag[] - A list of scope + tag pairs to associate with this resource.
- target
Owner stringType - targets
Policy
Constraint Target[] - Targets for the constraints to be enforced
- context
Policy
Constraint Context Args - The context which the object belongs to
- description str
- Description of the resource.
- display_
name str - Display name of the resource.
- instance_
counts Sequence[PolicyConstraint Instance Count Args] - Constraint details
- message str
- User friendly message to be shown to users upon violation.
- nsx_
id str - The NSX ID of this resource. If set, this ID will be used to create the resource.
- path str
- The NSX path of the policy resource.
- policy_
constraint_ strid - ID of the resource.
- revision float
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
-
Sequence[Policy
Constraint Tag Args] - A list of scope + tag pairs to associate with this resource.
- target_
owner_ strtype - targets
Sequence[Policy
Constraint Target Args] - Targets for the constraints to be enforced
- context Property Map
- The context which the object belongs to
- description String
- Description of the resource.
- display
Name String - Display name of the resource.
- instance
Counts List<Property Map> - Constraint details
- message String
- User friendly message to be shown to users upon violation.
- nsx
Id String - The NSX ID of this resource. If set, this ID will be used to create the resource.
- path String
- The NSX path of the policy resource.
- policy
Constraint StringId - ID of the resource.
- revision Number
- Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging.
- List<Property Map>
- A list of scope + tag pairs to associate with this resource.
- target
Owner StringType - targets List<Property Map>
- Targets for the constraints to be enforced
Supporting Types
PolicyConstraintContext, PolicyConstraintContextArgs
- Project
Id string - Id of the project which the resource belongs to.
- Project
Id string - Id of the project which the resource belongs to.
- project_
id string - Id of the project which the resource belongs to.
- project
Id String - Id of the project which the resource belongs to.
- project
Id string - Id of the project which the resource belongs to.
- project_
id str - Id of the project which the resource belongs to.
- project
Id String - Id of the project which the resource belongs to.
PolicyConstraintInstanceCount, PolicyConstraintInstanceCountArgs
- Count double
- Limit of instances
- Target
Resource stringType - Type of the resource that should be limited in instance count (refer to the table below)
- Operator string
- Either
<=or<. Default is<=
- Count float64
- Limit of instances
- Target
Resource stringType - Type of the resource that should be limited in instance count (refer to the table below)
- Operator string
- Either
<=or<. Default is<=
- count number
- Limit of instances
- target_
resource_ stringtype - Type of the resource that should be limited in instance count (refer to the table below)
- operator string
- Either
<=or<. Default is<=
- count Double
- Limit of instances
- target
Resource StringType - Type of the resource that should be limited in instance count (refer to the table below)
- operator String
- Either
<=or<. Default is<=
- count number
- Limit of instances
- target
Resource stringType - Type of the resource that should be limited in instance count (refer to the table below)
- operator string
- Either
<=or<. Default is<=
- count float
- Limit of instances
- target_
resource_ strtype - Type of the resource that should be limited in instance count (refer to the table below)
- operator str
- Either
<=or<. Default is<=
- count Number
- Limit of instances
- target
Resource StringType - Type of the resource that should be limited in instance count (refer to the table below)
- operator String
- Either
<=or<. Default is<=
PolicyConstraintTag, PolicyConstraintTagArgs
PolicyConstraintTarget, PolicyConstraintTargetArgs
- Path
Prefix string - Prefix match to the path
- Path
Prefix string - Prefix match to the path
- path_
prefix string - Prefix match to the path
- path
Prefix String - Prefix match to the path
- path
Prefix string - Prefix match to the path
- path_
prefix str - Prefix match to the path
- path
Prefix String - Prefix match to the path
Package Details
- Repository
- nsxt vmware/terraform-provider-nsxt
- License
- Notes
- This Pulumi package is based on the
nsxtTerraform Provider.
published on Monday, May 18, 2026 by vmware