Skip to content

Commit

Permalink
Make routed domain vlan pool optional (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
mthurstocisco authored May 25, 2024
1 parent 956c99f commit 9eaae69
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions aci_access_policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ module "aci_routed_domain" {

for_each = { for rd in try(local.access_policies.routed_domains, []) : rd.name => rd if local.modules.aci_routed_domain && var.manage_access_policies }
name = "${each.value.name}${local.defaults.apic.access_policies.routed_domains.name_suffix}"
vlan_pool = "${each.value.vlan_pool}${local.defaults.apic.access_policies.vlan_pools.name_suffix}"
vlan_pool = try("${each.value.vlan_pool}${local.defaults.apic.access_policies.routed_domains.name_suffix}", "")
vlan_pool_allocation = [for vp in try(local.access_policies.vlan_pools, []) : try(vp.allocation, local.defaults.apic.access_policies.vlan_pools.allocation) if vp.name == each.value.vlan_pool][0]
security_domains = try(each.value.security_domains, [])

depends_on = [
module.aci_vlan_pool,
]
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-aci-aaep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ module "aci_aaep" {
| [aci_rest_managed.infraProvAcc](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource |
| [aci_rest_managed.infraRsDomP](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource |
| [aci_rest_managed.infraRsFuncToEpg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource |
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->
2 changes: 1 addition & 1 deletion modules/terraform-aci-access-span-filter-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ module "aci_access_span_filter_group" {
|------|------|
| [aci_rest_managed.spanFilterEntry](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource |
| [aci_rest_managed.spanFilterGrp](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource |
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->
2 changes: 1 addition & 1 deletion modules/terraform-aci-routed-domain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module "aci_routed_domain" {
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_name"></a> [name](#input\_name) | Routed domain name. | `string` | n/a | yes |
| <a name="input_vlan_pool"></a> [vlan\_pool](#input\_vlan\_pool) | Vlan pool name. | `string` | n/a | yes |
| <a name="input_vlan_pool"></a> [vlan\_pool](#input\_vlan\_pool) | Vlan pool name. | `string` | `""` | no |
| <a name="input_vlan_pool_allocation"></a> [vlan\_pool\_allocation](#input\_vlan\_pool\_allocation) | Vlan pool allocation mode. Choices: `static`, `dynamic`. | `string` | `"static"` | no |
| <a name="input_security_domains"></a> [security\_domains](#input\_security\_domains) | Security domains associated to routed domain | `list(string)` | `[]` | no |

Expand Down
1 change: 1 addition & 0 deletions modules/terraform-aci-routed-domain/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ resource "aci_rest_managed" "l3extDomP" {
}

resource "aci_rest_managed" "infraRsVlanNs" {
count = var.vlan_pool != "" ? 1 : 0
dn = "${aci_rest_managed.l3extDomP.dn}/rsvlanNs"
class_name = "infraRsVlanNs"
content = {
Expand Down
2 changes: 1 addition & 1 deletion modules/terraform-aci-routed-domain/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variable "name" {
variable "vlan_pool" {
description = "Vlan pool name."
type = string

default = ""
validation {
condition = can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.vlan_pool))
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `:`, `-`. Maximum characters: 64."
Expand Down

0 comments on commit 9eaae69

Please sign in to comment.