-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Module 2 add bgp route summarization policies (#97)
Co-authored-by: dtatsumi <[email protected]>
- Loading branch information
1 parent
44bc607
commit 1ae334f
Showing
15 changed files
with
301 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
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
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
34 changes: 34 additions & 0 deletions
34
modules/terraform-aci-bgp-route-summarization-policy/.terraform-docs.yml
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,34 @@ | ||
version: '>= 0.14.0' | ||
|
||
formatter: markdown table | ||
|
||
content: |- | ||
# Terraform ACI BGP Route Summarization Policy Module | ||
Manages ACI BGP Route Summarization Policy | ||
Location in GUI: | ||
`Tenants` » `XXX` » `Policies` » `Protocol` » `BGP` » `BGP Route Summarization` | ||
## Examples | ||
```hcl | ||
{{ include "./examples/complete/main.tf" }} | ||
``` | ||
{{ .Requirements }} | ||
{{ .Providers }} | ||
{{ .Inputs }} | ||
{{ .Outputs }} | ||
{{ .Resources }} | ||
output: | ||
file: README.md | ||
mode: replace | ||
|
||
sort: | ||
enabled: false |
63 changes: 63 additions & 0 deletions
63
modules/terraform-aci-bgp-route-summarization-policy/README.md
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,63 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
# Terraform ACI BGP Route Summarization Policy Module | ||
|
||
Manages ACI BGP Route Summarization Policy | ||
|
||
Location in GUI: | ||
`Tenants` » `XXX` » `Policies` » `Protocol` » `BGP` » `BGP Route Summarization` | ||
|
||
## Examples | ||
|
||
```hcl | ||
module "aci_bgp_route_summarization_policy" { | ||
source = "netascode/nac-aci/aci//modules/terraform-aci-bgp-route-summarization-policy" | ||
version = ">= 0.8.0" | ||
name = "ABC" | ||
tenant = "TEN1" | ||
description = "My Description" | ||
as_set = true | ||
summary_only = false | ||
af_mcast = false | ||
af_ucast = true | ||
} | ||
``` | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 | | ||
| <a name="requirement_aci"></a> [aci](#requirement\_aci) | >= 2.0.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aci"></a> [aci](#provider\_aci) | >= 2.0.0 | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_tenant"></a> [tenant](#input\_tenant) | Tenant name. | `string` | n/a | yes | | ||
| <a name="input_name"></a> [name](#input\_name) | BGP Route Summarization Policy name. | `string` | n/a | yes | | ||
| <a name="input_description"></a> [description](#input\_description) | BGP Route Summarization Policy description. | `string` | `""` | no | | ||
| <a name="input_as_set"></a> [as\_set](#input\_as\_set) | Flag to as Generate AS-SET information. | `bool` | `false` | no | | ||
| <a name="input_summary_only"></a> [summary\_only](#input\_summary\_only) | Flag to as Do not advertise more specifics. | `bool` | `false` | no | | ||
| <a name="input_af_mcast"></a> [af\_mcast](#input\_af\_mcast) | Flag to as AF Mcast. | `bool` | `false` | no | | ||
| <a name="input_af_ucast"></a> [af\_ucast](#input\_af\_ucast) | Flag to as AF Ucast. | `bool` | `true` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_dn"></a> [dn](#output\_dn) | Distinguished name of `bgpRtSummPol` object. | | ||
| <a name="output_name"></a> [name](#output\_name) | BGP Route Summarization Policy name. | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aci_rest_managed.bgpRtSummPol](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource | | ||
<!-- END_TF_DOCS --> |
24 changes: 24 additions & 0 deletions
24
modules/terraform-aci-bgp-route-summarization-policy/examples/complete/.terraform-docs.yml
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,24 @@ | ||
version: '>= 0.14.0' | ||
|
||
formatter: markdown table | ||
|
||
content: |- | ||
# BGP Route Summarization Policy Example | ||
To run this example you need to execute: | ||
```bash | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
``` | ||
Note that this example will create resources. Resources can be destroyed with `terraform destroy`. | ||
```hcl | ||
{{ include "./main.tf" }} | ||
``` | ||
output: | ||
file: README.md | ||
mode: replace |
28 changes: 28 additions & 0 deletions
28
modules/terraform-aci-bgp-route-summarization-policy/examples/complete/README.md
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 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
# BGP Route Summarization Policy Example | ||
|
||
To run this example you need to execute: | ||
|
||
```bash | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
``` | ||
|
||
Note that this example will create resources. Resources can be destroyed with `terraform destroy`. | ||
|
||
```hcl | ||
module "aci_bgp_route_summarization_policy" { | ||
source = "netascode/nac-aci/aci//modules/terraform-aci-bgp-route-summarization-policy" | ||
version = ">= 0.8.0" | ||
name = "ABC" | ||
tenant = "TEN1" | ||
description = "My Description" | ||
as_set = true | ||
summary_only = false | ||
af_mcast = false | ||
af_ucast = true | ||
} | ||
``` | ||
<!-- END_TF_DOCS --> |
12 changes: 12 additions & 0 deletions
12
modules/terraform-aci-bgp-route-summarization-policy/examples/complete/main.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,12 @@ | ||
module "aci_bgp_route_summarization_policy" { | ||
source = "netascode/nac-aci/aci//modules/terraform-aci-bgp-route-summarization-policy" | ||
version = ">= 0.8.0" | ||
|
||
name = "ABC" | ||
tenant = "TEN1" | ||
description = "My Description" | ||
as_set = true | ||
summary_only = false | ||
af_mcast = false | ||
af_ucast = true | ||
} |
11 changes: 11 additions & 0 deletions
11
modules/terraform-aci-bgp-route-summarization-policy/examples/complete/versions.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,11 @@ | ||
|
||
terraform { | ||
required_version = ">= 1.0.0" | ||
|
||
required_providers { | ||
aci = { | ||
source = "CiscoDevNet/aci" | ||
version = ">= 2.0.0" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
modules/terraform-aci-bgp-route-summarization-policy/main.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,10 @@ | ||
resource "aci_rest_managed" "bgpRtSummPol" { | ||
dn = "uni/tn-${var.tenant}/bgprtsum-${var.name}" | ||
class_name = "bgpRtSummPol" | ||
content = { | ||
name = var.name | ||
descr = var.description | ||
ctrl = join(",", concat(var.as_set == true ? ["as-set"] : [], var.summary_only == true ? ["summary-only"] : [])) | ||
addrTCtrl = join(",", concat(var.af_mcast == true ? ["af-mcast"] : [], var.af_ucast == true ? ["af-ucast"] : [])) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
modules/terraform-aci-bgp-route-summarization-policy/outputs.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,9 @@ | ||
output "dn" { | ||
value = aci_rest_managed.bgpRtSummPol.id | ||
description = "Distinguished name of `bgpRtSummPol` object." | ||
} | ||
|
||
output "name" { | ||
value = aci_rest_managed.bgpRtSummPol.content.name | ||
description = "BGP Route Summarization Policy name." | ||
} |
54 changes: 54 additions & 0 deletions
54
modules/terraform-aci-bgp-route-summarization-policy/variables.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,54 @@ | ||
variable "tenant" { | ||
description = "Tenant name." | ||
type = string | ||
|
||
validation { | ||
condition = can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.tenant)) | ||
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `:`, `-`. Maximum characters: 64." | ||
} | ||
} | ||
|
||
variable "name" { | ||
description = "BGP Route Summarization Policy name." | ||
type = string | ||
|
||
validation { | ||
condition = can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.name)) | ||
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `:`, `-`. Maximum characters: 64." | ||
} | ||
} | ||
|
||
variable "description" { | ||
description = "BGP Route Summarization Policy description." | ||
type = string | ||
default = "" | ||
|
||
validation { | ||
condition = can(regex("^[a-zA-Z0-9\\!#$%()*,-./:;@ _{|}~?&+]{0,128}$", var.description)) | ||
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `\\`, `!`, `#`, `$`, `%`, `(`, `)`, `*`, `,`, `-`, `.`, `/`, `:`, `;`, `@`, ` `, `_`, `{`, `|`, }`, `~`, `?`, `&`, `+`. Maximum characters: 128." | ||
} | ||
} | ||
|
||
variable "as_set" { | ||
description = "Flag to as Generate AS-SET information." | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "summary_only" { | ||
description = "Flag to as Do not advertise more specifics." | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "af_mcast" { | ||
description = "Flag to as AF Mcast." | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "af_ucast" { | ||
description = "Flag to as AF Ucast." | ||
type = bool | ||
default = true | ||
} |
11 changes: 11 additions & 0 deletions
11
modules/terraform-aci-bgp-route-summarization-policy/versions.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,11 @@ | ||
|
||
terraform { | ||
required_version = ">= 1.0.0" | ||
|
||
required_providers { | ||
aci = { | ||
source = "CiscoDevNet/aci" | ||
version = ">= 2.0.0" | ||
} | ||
} | ||
} |