|
| 1 | +--- |
| 2 | +subcategory: "Beta" |
| 3 | +page_title: "NSXT: nsxt_policy_constraint" |
| 4 | +description: A resource to configure a Constraint (Quota). |
| 5 | +--- |
| 6 | + |
| 7 | +# nsxt_policy_constraint |
| 8 | + |
| 9 | +This resource provides a method for the management of a Constraint. |
| 10 | + |
| 11 | +This resource is applicable to NSX Policy Manager. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```hcl |
| 16 | +resource "nsxt_policy_constraint" "test" { |
| 17 | + display_name = "demo-quota" |
| 18 | + description = "Terraform provisioned Constraint" |
| 19 | + message = "too many objects mate" |
| 20 | +
|
| 21 | + target { |
| 22 | + path_prefix = "/orgs/default/projects/demo/" |
| 23 | + } |
| 24 | +
|
| 25 | + instance_count { |
| 26 | + count = 4 |
| 27 | + target_resource_type = "StaticRoutes" |
| 28 | + } |
| 29 | +
|
| 30 | + instance_count { |
| 31 | + count = 1 |
| 32 | + target_resource_type = "Infra.Tier1.PolicyDnsForwarder" |
| 33 | + } |
| 34 | +
|
| 35 | + instance_count { |
| 36 | + count = 20 |
| 37 | + target_resource_type = "Infra.Domain.Group" |
| 38 | + } |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +## Example Usage - Multi-Tenancy |
| 43 | + |
| 44 | +```hcl |
| 45 | +resource "nsxt_policy_constraint" "test" { |
| 46 | + context { |
| 47 | + project_id = "demo" |
| 48 | + } |
| 49 | +
|
| 50 | + display_name = "demo1-quota" |
| 51 | +
|
| 52 | + target { |
| 53 | + path_prefix = "/orgs/default/projects/demo/vpcs/demo1/" |
| 54 | + } |
| 55 | +
|
| 56 | + instance_count { |
| 57 | + count = 4 |
| 58 | + target_resource_type = "Org.Project.Vpc.PolicyNat.PolicyVpcNatRule" |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +## Argument Reference |
| 64 | + |
| 65 | +The following arguments are supported: |
| 66 | + |
| 67 | +* `context` - (Optional) The context which the object belongs to |
| 68 | +* `display_name` - (Required) Display name of the resource. |
| 69 | +* `description` - (Optional) Description of the resource. |
| 70 | +* `message` - (Optional) User friendly message to be shown to users upon violation. |
| 71 | +* `target` - (Optional) Targets for the constraints to be enforced |
| 72 | + * `path_prefix` - (Optional) Prefix match to the path |
| 73 | +* `instance_count` - (Optional) Constraint details |
| 74 | + * `target_resource_type` - (Required) Type of the resource that should be limited in instance count (refer to the table below) |
| 75 | + * `operator` - (Optional) Either `<=` or `<`. Default is `<=` |
| 76 | + * `count` - (Required) Limit of instances |
| 77 | +* `tag` - (Optional) A list of scope + tag pairs to associate with this resource. |
| 78 | +* `nsx_id` - (Optional) The NSX ID of this resource. If set, this ID will be used to create the resource. |
| 79 | + |
| 80 | + |
| 81 | +## Attributes Reference |
| 82 | + |
| 83 | +In addition to arguments listed above, the following attributes are exported: |
| 84 | + |
| 85 | +* `id` - ID of the resource. |
| 86 | +* `revision` - Indicates current revision number of the object as seen by NSX-T API server. This attribute can be useful for debugging. |
| 87 | +* `path` - The NSX path of the policy resource. |
| 88 | + |
| 89 | + |
| 90 | +## Target resource types |
| 91 | + |
| 92 | +|Object|project + VPC|project only|VPC only| |
| 93 | +|------|-------------|------------|--------| |
| 94 | +|Group|Group|Infra.Domain.Group|Org.Project.Vpc.Group| |
| 95 | +|Service||Infra.Service|| |
| 96 | +|Service Entry||Infra.Service.ServiceEntry|| |
| 97 | +|TLS Certificate||Infra.TlsCertificate|| |
| 98 | +|TLS CRL||Infra.TlsCrl|| |
| 99 | +|All Firewall Rules|Rule||| |
| 100 | +|Security Policy|SecurityPolicy|Infra.Domain.SecurityPolicy|Org.Project.Vpc.SecurityPolicy| |
| 101 | +|Security Policy Rule|SecurityPolicy.Rule|Infra.Domain.SecurityPolicy.Rule|Org.Project.Vpc.SecurityPolicy.Rule| |
| 102 | +|Gateway Policy|SecurityPolicy|Infra.Domain.SecurityPolicy|Org.Project.Vpc.SecurityPolicy| |
| 103 | +|Gateway Policy Rule|GatewayPolicy.Rule|Infra.Domain.GatewayPolicy.Rule|Org.Project.Vpc.GatewayPolicy.Rule| |
| 104 | +|IDS Security Policy||Infra.Domain.IdsPolicy|| |
| 105 | +|IDS Security Policy Rule||Infra.Domain.IdsPolicy.Rule|| |
| 106 | +|Session Timer Profile||Infra.PolicyFirewallSessionTimerProfile|| |
| 107 | +|Flood Protection Profile||Infra.FloodProtectionProfile|| |
| 108 | +|DNS Security Profile||Infra.DnsSecurityProfile|| |
| 109 | +|Context Profile||Infra.PolicyContextProfile|| |
| 110 | +|l7 Access Profile||Infra.L7AccessProfile|| |
| 111 | +|Tier1 Gateway||Infra.Tier1|| |
| 112 | +|Segment||Infra.Segment|| |
| 113 | +|Segment Port||Infra.Segment.SegmentPort|| |
| 114 | +|Subnet|||Org.Project.Vpc.Subnet| |
| 115 | +|Subnet Port|||Org.Project.Vpc.Subnet.SubnetPort| |
| 116 | +|Segment Security Profile||Infra.SegmentSecurityProfile|| |
| 117 | +|Segment QoS Profile||Infra.QosProfile|| |
| 118 | +|Segment IP Discovery Profile||Infra.IpDiscoveryProfile|| |
| 119 | +|Segment MAC Discovery Profile||Infra.MacDiscoveryProfile|| |
| 120 | +|Segment Spoof Guard Profile||Infra.SpoofGuardProfile|| |
| 121 | +|IPv6 NDRA Profile||Infra.Ipv6NdraProfile|| |
| 122 | +|IPv6 DAD Profile||Infra.Ipv6DadProfile|| |
| 123 | +|Gateway QoS Profile||Infra.GatewayQosProfile|| |
| 124 | +|Static Routes|StaticRoutes|Infra.Tier1.StaticRoutes|Org.Project.Vpc.StaticRoutes| |
| 125 | +|NAT Rule|NatRule|Infra.Tier1.PolicyNat.PolicyNatRule|Org.Project.Vpc.PolicyNat.PolicyNatRule| |
| 126 | +|DNS Forwarder Zone||Infra.PolicyDnsForwarderZone|| |
| 127 | +|DNS Forwarder||Infra.Tier1.PolicyDnsForwarder|| |
| 128 | +|IP Address Block||Infra.IpAddressBlock|| |
| 129 | +|IP Address Pool||Infra.IpAddressPool|| |
| 130 | +|IP Address Pool Subnet||Infra.IpAddressPool.IpAddressPoolSubnet|| |
| 131 | +|IP Address Allocation||Infra.IpAddressPool.IpAddressAllocation|| |
| 132 | +|DHCP Server Config||Infra.DhcpServerConfig|| |
| 133 | +|IPSec VPN Service||Infra.Tier1.IPSecVpnService|| |
| 134 | +|IPSec VPN Session||Infra.Tier1.IPSecVpnService.IPSecVpnSession|| |
| 135 | +|IPSec VPN Local Endpoint||Infra.Tier1.IPSecVpnService.IPSecVpnLocalEndpoint|| |
| 136 | +|IPSec VPN Tunnel Profile||Infra.IPSecVpnTunnelProfile|| |
| 137 | +|IPSec VPN IKE Profile||Infra.IPSecVpnIkeProfile|| |
| 138 | +|IPSec VPN DPD Profile||Infra.IPSecVpnDpdProfile|| |
| 139 | +|L2 VPN Service||Infra.Tier1.L2VpnService|| |
| 140 | +|L2 VPN Session||Infra.Tier1.L2VpnService.L2VpnSession|| |
| 141 | +|VPC||Org.Project.Vpc|| |
| 142 | + |
| 143 | + |
| 144 | +## Importing |
| 145 | + |
| 146 | +An existing object can be [imported][docs-import] into this resource, via the following command: |
| 147 | + |
| 148 | +[docs-import]: https://www.terraform.io/cli/import |
| 149 | + |
| 150 | +``` |
| 151 | +terraform import nsxt_policy_constraint.test PATH |
| 152 | +``` |
| 153 | + |
| 154 | +The above command imports Constraint named `test` with the NSX path `PATH`. |
0 commit comments