Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Dec 20, 2024
1 parent 80365a3 commit dce8ca5
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 9 deletions.
16 changes: 7 additions & 9 deletions apstra/blueprint/routing_zone_constraint.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,13 @@ func (o DatacenterRoutingZoneConstraint) ResourceAttributes() map[string]resourc
Validators: []validator.Int64{int64validator.Between(0, 255)},
},
"routing_zones_list_constraint": resourceSchema.StringAttribute{
MarkdownDescription: fmt.Sprintf(
fmt.Sprintf("Instance constraint mode.\n"+
"- `%s` - only allow the specified routing zones (add specific routing zones to allow)\n"+
"- `%s` - denies allocation of specified routing zones (add specific routing zones to deny)\n"+
"- `%s` - no additional constraints on routing zones (any routing zones)",
utils.StringersToFriendlyString(enum.RoutingZoneConstraintModeAllow),
utils.StringersToFriendlyString(enum.RoutingZoneConstraintModeDeny),
utils.StringersToFriendlyString(enum.RoutingZoneConstraintModeNone),
),
MarkdownDescription: fmt.Sprintf("Instance constraint mode.\n"+
"- `%s` - only allow the specified routing zones (add specific routing zones to allow)\n"+
"- `%s` - denies allocation of specified routing zones (add specific routing zones to deny)\n"+
"- `%s` - no additional constraints on routing zones (any routing zones)",
utils.StringersToFriendlyString(enum.RoutingZoneConstraintModeAllow),
utils.StringersToFriendlyString(enum.RoutingZoneConstraintModeDeny),
utils.StringersToFriendlyString(enum.RoutingZoneConstraintModeNone),
),
Required: true,
Validators: []validator.String{stringvalidator.OneOf(
Expand Down
63 changes: 63 additions & 0 deletions docs/data-sources/datacenter_routing_zone_constraint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
page_title: "apstra_datacenter_routing_zone_constraint Data Source - terraform-provider-apstra"
subcategory: "Reference Design: Datacenter"
description: |-
This resource returns details of a Routing Zone Constraint within a Datacenter Blueprint.
At least one optional attribute is required.
---

# apstra_datacenter_routing_zone_constraint (Data Source)

This resource returns details of a Routing Zone Constraint within a Datacenter Blueprint.

At least one optional attribute is required.


## Example Usage

```terraform
# This example pulls the details of a Routing Zone Constraint
# using a "by name" lookup. Lookup by ID is also supported.
data "apstra_datacenter_routing_zone_constraint" "vasili" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
name = "one_zone_only"
}
output "routing_zone_constraint" {
value = data.apstra_datacenter_routing_zone_constraint.vasili
}
# The output looks like this:
# routing_zone_constraint = {
# "blueprint_id" = "372eca0d-41de-47cc-a17d-65f27960ca3f"
# "constraints" = toset([
# "6uEL07avVGEjxXYiZQ",
# "J7ApJRAmqWOIjVCV4A",
# "a8cU-tv0eNwj-KG-wg",
# ])
# "id" = "qEH5mRPjsxhuyDovLg"
# "max_count_constraint" = 1
# "name" = "one_zone_only"
# "routing_zones_list_constraint" = "allow"
# }
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `blueprint_id` (String) Apstra Blueprint ID.

### Optional

- `id` (String) Apstra graph node ID. Required when `name` is omitted.
- `name` (String) Name displayed in the Apstra web UI. Required when `id` is omitted.

### Read-Only

- `constraints` (Set of String) When `allow` instance constraint mode is chosen, only VNs from selected Routing Zones are allowed to have endpoints on the interface(s) the policy is applied to. The permitted Routing Zones may be specified directly or indirectly (via Routing Zone Groups)
- `max_count_constraint` (Number) The maximum number of Routing Zones that the Application Point can be part of.
- `routing_zones_list_constraint` (String) Routing Zone constraint mode. One of: `allow`, `deny`, `none`.
113 changes: 113 additions & 0 deletions docs/data-sources/datacenter_routing_zone_constraints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
page_title: "apstra_datacenter_routing_zone_constraints Data Source - terraform-provider-apstra"
subcategory: "Reference Design: Datacenter"
description: |-
This data source returns the IDs of Routing Zone Constraints within the specified Blueprint. All of the filter attributes are optional.
---

# apstra_datacenter_routing_zone_constraints (Data Source)

This data source returns the IDs of Routing Zone Constraints within the specified Blueprint. All of the `filter` attributes are optional.


## Example Usage

```terraform
# This example uses filters to find the ID of every Routing Zone
# Constraint which ether allows the routing zone named "dev-1"
# or allows the routing zone named "dev-2"
data "apstra_datacenter_routing_zone" "dev-1" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
name = "dev-1"
}
data "apstra_datacenter_routing_zone" "dev-2" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
name = "dev-2"
}
data "apstra_datacenter_routing_zone_constraints" "allow_dev_1_or_dev_2" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
filters = [
{
routing_zones_list_constraint = "allow"
constraints = [data.apstra_datacenter_routing_zone.dev-1.id]
},
{
routing_zones_list_constraint = "allow"
constraints = [data.apstra_datacenter_routing_zone.dev-2.id]
},
]
}
output "constraint_allowing_dev_1_or_dev_2" {
value = data.apstra_datacenter_routing_zone_constraints.allow_dev_1_or_dev_2
}
# The output looks like this:
# constraint_allowing_dev_1_or_dev_2 = {
# "blueprint_id" = "372eca0d-41de-47cc-a17d-65f27960ca3f"
# "filters" = tolist([
# {
# "blueprint_id" = tostring(null)
# "constraints" = toset([
# "a8cU-tv0eNwj-KG-wg",
# ])
# "id" = tostring(null)
# "max_count_constraint" = tonumber(null)
# "name" = tostring(null)
# "routing_zones_list_constraint" = "allow"
# },
# {
# "blueprint_id" = tostring(null)
# "constraints" = toset([
# "6uEL07avVGEjxXYiZQ",
# ])
# "id" = tostring(null)
# "max_count_constraint" = tonumber(null)
# "name" = tostring(null)
# "routing_zones_list_constraint" = "allow"
# },
# ])
# "graph_queries" = tolist([
# "match(node(name='n_routing_zone_constraint',type='routing_zone_constraint',routing_zones_list_constraint='allow'),node(name='n_routing_zone_constraint').out(type='constraint').node(type='security_zone',id='a8cU-tv0eNwj-KG-wg'))",
# "match(node(name='n_routing_zone_constraint',type='routing_zone_constraint',routing_zones_list_constraint='allow'),node(name='n_routing_zone_constraint').out(type='constraint').node(type='security_zone',id='6uEL07avVGEjxXYiZQ'))",
# ])
# "ids" = toset([
# "nbe8Ly6zUwXWWdGMjQ",
# "qEH5mRPjsxhuyDovLg",
# ])
# }
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `blueprint_id` (String) Apstra Blueprint ID.

### Optional

- `filters` (Attributes List) List of filters used to select only desired node IDs. For a node to match a filter, all specified attributes must match (each attribute within a filter is AND-ed together). The returned node IDs represent the nodes matched by all of the filters together (filters are OR-ed together). (see [below for nested schema](#nestedatt--filters))

### Read-Only

- `graph_queries` (List of String) Graph datastore queries which performed the lookup based on supplied filters.
- `ids` (Set of String) Set of Routing Zone Constraint IDs

<a id="nestedatt--filters"></a>
### Nested Schema for `filters`

Optional:

- `constraints` (Set of String) Set of Routing Zone IDs. All Routing Zones supplied here are used to match the Routing Zone Constraint, but a matching Routing Zone Constraintmay have additional Security Zones not enumerated in this set.
- `max_count_constraint` (Number) The maximum number of Routing Zones that the Application Point can be part of.
- `name` (String) Name displayed in the Apstra web UI.
- `routing_zones_list_constraint` (String) Routing Zone constraint mode. One of: `allow`, `deny`, `none`.

Read-Only:

- `blueprint_id` (String) Not applicable in filter context. Ignore.
- `id` (String) Not applicable in filter context. Ignore.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This example pulls the details of a Routing Zone Constraint
# using a "by name" lookup. Lookup by ID is also supported.

data "apstra_datacenter_routing_zone_constraint" "vasili" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
name = "one_zone_only"
}

output "routing_zone_constraint" {
value = data.apstra_datacenter_routing_zone_constraint.vasili
}

# The output looks like this:

# routing_zone_constraint = {
# "blueprint_id" = "372eca0d-41de-47cc-a17d-65f27960ca3f"
# "constraints" = toset([
# "6uEL07avVGEjxXYiZQ",
# "J7ApJRAmqWOIjVCV4A",
# "a8cU-tv0eNwj-KG-wg",
# ])
# "id" = "qEH5mRPjsxhuyDovLg"
# "max_count_constraint" = 1
# "name" = "one_zone_only"
# "routing_zones_list_constraint" = "allow"
# }
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This example uses filters to find the ID of every Routing Zone
# Constraint which ether allows the routing zone named "dev-1"
# or allows the routing zone named "dev-2"

data "apstra_datacenter_routing_zone" "dev-1" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
name = "dev-1"
}

data "apstra_datacenter_routing_zone" "dev-2" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
name = "dev-2"
}

data "apstra_datacenter_routing_zone_constraints" "allow_dev_1_or_dev_2" {
blueprint_id = "372eca0d-41de-47cc-a17d-65f27960ca3f"
filters = [
{
routing_zones_list_constraint = "allow"
constraints = [data.apstra_datacenter_routing_zone.dev-1.id]
},
{
routing_zones_list_constraint = "allow"
constraints = [data.apstra_datacenter_routing_zone.dev-2.id]
},
]
}

output "constraint_allowing_dev_1_or_dev_2" {
value = data.apstra_datacenter_routing_zone_constraints.allow_dev_1_or_dev_2
}

# The output looks like this:
# constraint_allowing_dev_1_or_dev_2 = {
# "blueprint_id" = "372eca0d-41de-47cc-a17d-65f27960ca3f"
# "filters" = tolist([
# {
# "blueprint_id" = tostring(null)
# "constraints" = toset([
# "a8cU-tv0eNwj-KG-wg",
# ])
# "id" = tostring(null)
# "max_count_constraint" = tonumber(null)
# "name" = tostring(null)
# "routing_zones_list_constraint" = "allow"
# },
# {
# "blueprint_id" = tostring(null)
# "constraints" = toset([
# "6uEL07avVGEjxXYiZQ",
# ])
# "id" = tostring(null)
# "max_count_constraint" = tonumber(null)
# "name" = tostring(null)
# "routing_zones_list_constraint" = "allow"
# },
# ])
# "graph_queries" = tolist([
# "match(node(name='n_routing_zone_constraint',type='routing_zone_constraint',routing_zones_list_constraint='allow'),node(name='n_routing_zone_constraint').out(type='constraint').node(type='security_zone',id='a8cU-tv0eNwj-KG-wg'))",
# "match(node(name='n_routing_zone_constraint',type='routing_zone_constraint',routing_zones_list_constraint='allow'),node(name='n_routing_zone_constraint').out(type='constraint').node(type='security_zone',id='6uEL07avVGEjxXYiZQ'))",
# ])
# "ids" = toset([
# "nbe8Ly6zUwXWWdGMjQ",
# "qEH5mRPjsxhuyDovLg",
# ])
# }

0 comments on commit dce8ca5

Please sign in to comment.