-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
todo: - resource tests - constraint data source - constraints data source
- Loading branch information
1 parent
5b05612
commit 76a8f08
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
page_title: "apstra_datacenter_routing_zone_constraint Resource - terraform-provider-apstra" | ||
subcategory: "Reference Design: Datacenter" | ||
description: |- | ||
This resource creates a Routing Zone Constraint within a Datacenter Blueprint. | ||
--- | ||
|
||
# apstra_datacenter_routing_zone_constraint (Resource) | ||
|
||
This resource creates a Routing Zone Constraint within a Datacenter Blueprint. | ||
|
||
|
||
## Example Usage | ||
|
||
```terraform | ||
# This example creates a Routing Zone Constraint which permits exactly one "dev" | ||
# Routing Zone anywhere it is applied. | ||
# First, collect all routing zone IDs in the blueprint | ||
data "apstra_datacenter_routing_zones" "all" { | ||
blueprint_id = local.blueprint_id | ||
} | ||
# Second, collect details about each of those routing zones | ||
data "apstra_datacenter_routing_zone" "all" { | ||
for_each = data.apstra_datacenter_routing_zones.all.ids | ||
blueprint_id = local.blueprint_id | ||
id = each.key | ||
} | ||
# Finally, create the Routing Zone Constraint | ||
resource "apstra_datacenter_routing_zone_constraint" "example" { | ||
blueprint_id = local.blueprint_id | ||
name = "Permit 1 dev RZ" | ||
max_count_constraint = 1 | ||
routing_zones_list_constraint = "allow" | ||
# Constraints is created as a list comprehension by iterating over | ||
# details of each RZ in data.apstra_datacenter_routing_zone.all | ||
constraints = [ | ||
for rz in data.apstra_datacenter_routing_zone.all : rz.id | ||
if strcontains(rz.name, "dev") // select those with "dev" in their name | ||
] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `blueprint_id` (String) Apstra Blueprint ID. | ||
- `name` (String) Name displayed in the Apstra web UI. | ||
- `routing_zones_list_constraint` (String) Instance constraint mode. | ||
- `allow` - only allow the specified routing zones (add specific routing zones to allow) | ||
- `deny` - denies allocation of specified routing zones (add specific routing zones to deny) | ||
- `none` - no additional constraints on routing zones (any routing zones) | ||
|
||
### Optional | ||
|
||
- `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. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) Apstra graph node ID. | ||
|
||
|
||
|
28 changes: 28 additions & 0 deletions
28
examples/resources/apstra_datacenter_routing_zone_constraint/example.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This example creates a Routing Zone Constraint which permits exactly one "dev" | ||
# Routing Zone anywhere it is applied. | ||
|
||
# First, collect all routing zone IDs in the blueprint | ||
data "apstra_datacenter_routing_zones" "all" { | ||
blueprint_id = local.blueprint_id | ||
} | ||
|
||
# Second, collect details about each of those routing zones | ||
data "apstra_datacenter_routing_zone" "all" { | ||
for_each = data.apstra_datacenter_routing_zones.all.ids | ||
blueprint_id = local.blueprint_id | ||
id = each.key | ||
} | ||
|
||
# Finally, create the Routing Zone Constraint | ||
resource "apstra_datacenter_routing_zone_constraint" "example" { | ||
blueprint_id = local.blueprint_id | ||
name = "Permit 1 dev RZ" | ||
max_count_constraint = 1 | ||
routing_zones_list_constraint = "allow" | ||
# Constraints is created as a list comprehension by iterating over | ||
# details of each RZ in data.apstra_datacenter_routing_zone.all | ||
constraints = [ | ||
for rz in data.apstra_datacenter_routing_zone.all : rz.id | ||
if strcontains(rz.name, "dev") // select those with "dev" in their name | ||
] | ||
} |