From 91f82dd91386470d41559f3c495ff970c6836e8e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:22:46 -0700 Subject: [PATCH] generate-terraform-docs: automated action (#142) Signed-off-by: GitHub Co-authored-by: thogarty --- .../README.md | 383 ++++++++++++++++++ modules/cloud-router-route-filters/README.md | 146 +++++++ 2 files changed, 529 insertions(+) diff --git a/examples/cloud-router-2-port-connection-with-route-filters/README.md b/examples/cloud-router-2-port-connection-with-route-filters/README.md index 16109f5..d017a6b 100644 --- a/examples/cloud-router-2-port-connection-with-route-filters/README.md +++ b/examples/cloud-router-2-port-connection-with-route-filters/README.md @@ -10,3 +10,386 @@ provided to this example; or based on the pattern you see used in this example i you to create a more specific use case for your own needs. See example usage below for details on how to use this example. + + +## Equinix Fabric Developer Documentation + +To see the documentation for the APIs that the Fabric Terraform Provider is built on +and to learn how to procure your own Client_Id and Client_Secret follow the link below: +[Equinix Fabric Developer Portal](https://developer.equinix.com/docs?page=/dev-docs/fabric/overview) + +## Usage of Example as Terraform Module + +To provision this example directly as a usable module please use the *Provision Instructions* provided by Hashicorp +in the upper right of this page and be sure to include at a minimum the required variables. + +## Usage of Example Locally or in Your Own Configuration + +*Note:* This example creates resources which cost money. Run 'terraform destroy' when you don't need these resources. + +To provision this example directly, +you should clone the github repository for this module and run terraform within this directory: + +```bash +git clone https://github.com/equinix/terraform-equinix-fabric.git +cd terraform-equinix-fabric/examples/cloud-router-2-port-connection-with-route-filters +terraform init +terraform apply +``` + +To use this example of the module in your own terraform configuration include the following: + +*NOTE: terraform.tfvars must be a separate file, but all other content can be placed together in main.tf if you prefer* + +terraform.tfvars (Replace these values with your own): +```hcl +equinix_client_id = "" +equinix_client_secret = "" + + +cloud_router_name = "cloud_router_alpha" +cloud_router_type = "XF_ROUTER" +cloud_router_metro_code = "DC" +cloud_router_package = "STANDARD" + +project_id = "" +account_number = "" + +notifications_type = "ALL" +notifications_emails = ["example@equinix.com","test1@equinix.com"] +purchase_order_number = "1-323292" +connection_name = "fcr_2_port" +connection_type = "IP_VC" +bandwidth = 50 +zside_ap_type = "COLO" +zside_vlan_tag = "2711" +zside_location = "SV" +zside_port_name = "" + +routing_protocol_direct_rp_name = "DRP_PFCR" +routing_protocol_direct_ipv4_ip = "10.2.1.1/30" +routing_protocol_bgp_rp_name = "BGPRP_PFCR" +routing_protocol_bgp_ipv4_ip = "10.2.1.2/30" +routing_protocol_bgp_customer_asn = 4007 + +route_filter_direction = "INBOUND" +route_filter_policy_name = "rf_policy_PFCR" +route_filter_policy_type = "BGP_IPv4_PREFIX_FILTER" + +route_filter_rules = [ + { + name = "rule_1", + prefix = "192.168.0.0/24", + prefix_match = "exact", + description = "first rule on route filter" + }, + { + name = "rule_2", + prefix = "192.168.1.0/24", + prefix_match = "or_longer", + description = "second rule on route filter" + } +] + + +``` + +versions.tf +```hcl +terraform { + required_version = ">= 1.5.4" + required_providers { + equinix = { + source = "equinix/equinix" + version = ">= 2.8.0" + } + } +} +``` + +variables.tf + ```hcl +variable "equinix_client_id" { + description = "Equinix client ID (consumer key), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "equinix_client_secret" { + description = "Equinix client secret ID (consumer secret), obtained after registering app in the developer platform" + type = string + sensitive = true +} +variable "connection_name" { + description = "Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores" + type = string +} +variable "connection_type" { + description = "Defines the connection type like VG_VC, EVPL_VC, EPL_VC, EC_VC, IP_VC, ACCESS_EPL_VC" + type = string + default = "" +} +variable "notifications_type" { + description = "Notification Type - ALL is the only type currently supported" + type = string + default = "ALL" +} +variable "notifications_emails" { + description = "Array of contact emails" + type = list(string) +} +variable "bandwidth" { + description = "Connection bandwidth in Mbps" + type = number +} +variable "purchase_order_number" { + description = "Purchase order number" + type = string + default = "" +} +variable "zside_port_name" { + description = "Equinix Zside Port Name" + type = string +} +variable "zside_ap_type" { + description = "Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW" + type = string + default = "SP" +} +variable "zside_vlan_tag" { + description = "Access point protocol Vlan tag number for DOT1Q or QINQ connections" + default = "" +} +variable "zside_location" { + description = "Access point metro code" + type = string + default = "SP" +} + +variable "cloud_router_name" { + description = "Name of the cloud router created for the connection" + type = string +} + +variable "cloud_router_type" { + description = "Type of the cloud router created for the connection" + type = string +} + +variable "cloud_router_metro_code" { + description = "Name of the cloud router created for the connection" + type = string +} + +variable "cloud_router_package" { + description = "Package of the cloud router created for the connection" + type = string +} + +variable "project_id" { + description = "Id of the Fabric Project for the resources to be created in" + type = string +} + +variable "account_number" { + description = "Account number for the cloud router creation" + type = number +} + +variable "route_filter_direction" { + description = "Direction of the route filtering [INBOUND or OUTBOUND]" + type = string +} + +variable "route_filter_policy_name" { + description = "Name of the route filter policy that will be created in this module" + type = string +} + +variable "route_filter_policy_type" { + description = "Type of the route filter policy. Should be one of: BGP_IPv4_PREFIX_FILTER, BGP_IPv6_PREFIX_FILTER" + type = string +} + +variable "route_filter_rules" { + description = "List of route filter rules to add to the created route filter policy" + type = list(object({ + prefix = string, + name = optional(string), + description = optional(string), + prefix_match = optional(string), + })) +} + +variable "routing_protocol_direct_rp_name" { + description = "Name of the Direct Routing Protocol Added to the Cloud Router Connection" + type = string +} + +variable "routing_protocol_direct_ipv4_ip" { + description = "Ipv4 Ip address for Cloud Router Direct Routing Protocol" + type = string +} + +variable "routing_protocol_bgp_rp_name" { + description = "Ipv4 Ip address for Cloud Router Bgp Routing Protocol" +} + +variable "routing_protocol_bgp_ipv4_ip" { + description = "Ipv4 Ip address for Cloud Router Direct Routing Protocol" + type = string +} + +variable "routing_protocol_bgp_customer_asn" { + description = "Customer ASN number for BGP Routing Protocol" + type = number +} +``` + +outputs.tf +```hcl +output "port_connection_id" { + value = module.cloud_router_port_connection.primary_connection_id +} +``` + +main.tf +```hcl +provider "equinix" { + client_id = var.equinix_client_id + client_secret = var.equinix_client_secret +} + +resource "equinix_fabric_cloud_router" "this" { + type = var.cloud_router_type + name = var.cloud_router_name + location { + metro_code = var.cloud_router_metro_code + } + package { + code = var.cloud_router_package + } + order { + purchase_order_number = var.purchase_order_number + } + notifications { + type = var.notifications_type + emails = var.notifications_emails + } + project { + project_id = var.project_id + } + account { + account_number = var.account_number + } +} + +module "cloud_router_port_connection" { + source = "equinix/fabric/equinix//modules/cloud-router-connection" + + connection_name = var.connection_name + connection_type = var.connection_type + notifications_type = var.notifications_type + notifications_emails = var.notifications_emails + bandwidth = var.bandwidth + purchase_order_number = var.purchase_order_number + project_id = var.project_id + + #Aside + aside_fcr_uuid = equinix_fabric_cloud_router.this.id + + #Zside + zside_ap_type = var.zside_ap_type + zside_location = var.zside_location + zside_port_name = var.zside_port_name + zside_vlan_tag = var.zside_vlan_tag +} + +module "cloud_router_connection_routing_protocols" { + source = "equinix/fabric/equinix//modules/cloud-router-routing-protocols" + connection_uuid = module.cloud_router_port_connection.primary_connection_id + direct_rp_name = var.routing_protocol_direct_rp_name + direct_equinix_ipv4_ip = var.routing_protocol_direct_ipv4_ip + bgp_rp_name = var.routing_protocol_bgp_rp_name + bgp_customer_peer_ipv4 = var.routing_protocol_bgp_ipv4_ip + bgp_customer_asn = var.routing_protocol_bgp_customer_asn +} + +module "cloud_router_route_filters" { + depends_on = [ module.cloud_router_connection_routing_protocols ] + source = "equinix/fabric/equinix//modules/cloud-router-route-filters" + connection_id = module.cloud_router_port_connection.primary_connection_id + connection_route_filter_direction = var.route_filter_direction + + route_filter_policy_name = var.route_filter_policy_name + route_filter_policy_project_id = var.project_id + route_filter_policy_type = var.route_filter_policy_type + + route_filter_rules = var.route_filter_rules +} +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.4 | +| [equinix](#requirement\_equinix) | >= 2.8.0 | + +## Providers + +| Name | Version | +|------|---------| +| [equinix](#provider\_equinix) | >= 2.8.0 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [cloud\_router\_connection\_routing\_protocols](#module\_cloud\_router\_connection\_routing\_protocols) | equinix/fabric/equinix//modules/cloud-router-routing-protocols | n/a | +| [cloud\_router\_port\_connection](#module\_cloud\_router\_port\_connection) | equinix/fabric/equinix//modules/cloud-router-connection | n/a | +| [cloud\_router\_route\_filters](#module\_cloud\_router\_route\_filters) | equinix/fabric/equinix//modules/cloud-router-route-filters | n/a | + +## Resources + +| Name | Type | +|------|------| +| [equinix_fabric_cloud_router.this](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/fabric_cloud_router) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [account\_number](#input\_account\_number) | Account number for the cloud router creation | `number` | n/a | yes | +| [bandwidth](#input\_bandwidth) | Connection bandwidth in Mbps | `number` | n/a | yes | +| [cloud\_router\_metro\_code](#input\_cloud\_router\_metro\_code) | Name of the cloud router created for the connection | `string` | n/a | yes | +| [cloud\_router\_name](#input\_cloud\_router\_name) | Name of the cloud router created for the connection | `string` | n/a | yes | +| [cloud\_router\_package](#input\_cloud\_router\_package) | Package of the cloud router created for the connection | `string` | n/a | yes | +| [cloud\_router\_type](#input\_cloud\_router\_type) | Type of the cloud router created for the connection | `string` | n/a | yes | +| [connection\_name](#input\_connection\_name) | Connection name. An alpha-numeric 24 characters string which can include only hyphens and underscores | `string` | n/a | yes | +| [connection\_type](#input\_connection\_type) | Defines the connection type like VG\_VC, EVPL\_VC, EPL\_VC, EC\_VC, IP\_VC, ACCESS\_EPL\_VC | `string` | `""` | no | +| [equinix\_client\_id](#input\_equinix\_client\_id) | Equinix client ID (consumer key), obtained after registering app in the developer platform | `string` | n/a | yes | +| [equinix\_client\_secret](#input\_equinix\_client\_secret) | Equinix client secret ID (consumer secret), obtained after registering app in the developer platform | `string` | n/a | yes | +| [notifications\_emails](#input\_notifications\_emails) | Array of contact emails | `list(string)` | n/a | yes | +| [notifications\_type](#input\_notifications\_type) | Notification Type - ALL is the only type currently supported | `string` | `"ALL"` | no | +| [project\_id](#input\_project\_id) | Id of the Fabric Project for the resources to be created in | `string` | n/a | yes | +| [purchase\_order\_number](#input\_purchase\_order\_number) | Purchase order number | `string` | `""` | no | +| [route\_filter\_direction](#input\_route\_filter\_direction) | Direction of the route filtering [INBOUND or OUTBOUND] | `string` | n/a | yes | +| [route\_filter\_policy\_name](#input\_route\_filter\_policy\_name) | Name of the route filter policy that will be created in this module | `string` | n/a | yes | +| [route\_filter\_policy\_type](#input\_route\_filter\_policy\_type) | Type of the route filter policy. Should be one of: BGP\_IPv4\_PREFIX\_FILTER, BGP\_IPv6\_PREFIX\_FILTER | `string` | n/a | yes | +| [route\_filter\_rules](#input\_route\_filter\_rules) | List of route filter rules to add to the created route filter policy |
list(object({
prefix = string,
name = optional(string),
description = optional(string),
prefix_match = optional(string),
}))
| n/a | yes | +| [routing\_protocol\_bgp\_customer\_asn](#input\_routing\_protocol\_bgp\_customer\_asn) | Customer ASN number for BGP Routing Protocol | `number` | n/a | yes | +| [routing\_protocol\_bgp\_ipv4\_ip](#input\_routing\_protocol\_bgp\_ipv4\_ip) | Ipv4 Ip address for Cloud Router Direct Routing Protocol | `string` | n/a | yes | +| [routing\_protocol\_bgp\_rp\_name](#input\_routing\_protocol\_bgp\_rp\_name) | Ipv4 Ip address for Cloud Router Bgp Routing Protocol | `any` | n/a | yes | +| [routing\_protocol\_direct\_ipv4\_ip](#input\_routing\_protocol\_direct\_ipv4\_ip) | Ipv4 Ip address for Cloud Router Direct Routing Protocol | `string` | n/a | yes | +| [routing\_protocol\_direct\_rp\_name](#input\_routing\_protocol\_direct\_rp\_name) | Name of the Direct Routing Protocol Added to the Cloud Router Connection | `string` | n/a | yes | +| [zside\_ap\_type](#input\_zside\_ap\_type) | Access point type - COLO, VD, VG, SP, IGW, SUBNET, GW | `string` | `"SP"` | no | +| [zside\_location](#input\_zside\_location) | Access point metro code | `string` | `"SP"` | no | +| [zside\_port\_name](#input\_zside\_port\_name) | Equinix Zside Port Name | `string` | n/a | yes | +| [zside\_vlan\_tag](#input\_zside\_vlan\_tag) | Access point protocol Vlan tag number for DOT1Q or QINQ connections | `string` | `""` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [port\_connection\_id](#output\_port\_connection\_id) | n/a | + \ No newline at end of file diff --git a/modules/cloud-router-route-filters/README.md b/modules/cloud-router-route-filters/README.md index 28f3eb4..8f332ca 100644 --- a/modules/cloud-router-route-filters/README.md +++ b/modules/cloud-router-route-filters/README.md @@ -5,3 +5,149 @@ and attach the Route Filter Policy to an existing Fabric Connection. Please refer to the cloud-router-2-port-connection-with-route-filters example in this module's registry for more details on how to leverage the submodule. + + +## Equinix Fabric Developer Documentation + +To see the documentation for the APIs that the Fabric Terraform Provider is built on +and to learn how to procure your own Client_Id and Client_Secret follow the link below: +[Equinix Fabric Developer Portal](https://developer.equinix.com/docs?page=/dev-docs/fabric/overview) + +## Modules File Content + +#versions.tf +```hcl +terraform { + required_version = ">= 1.5.4" + required_providers { + equinix = { + source = "equinix/equinix" + version = ">= 2.8.0" + } + } +} +``` + +#variables.tf + ```hcl +variable "route_filter_policy_name" { + description = "Name of the route filter policy that will be created in this module" + type = string +} + +variable "route_filter_policy_project_id" { + description = "Project id where the route filter policy will be created. Should match the project id of the connection you would like to attach the route filter policy to" + type = string +} + +variable "route_filter_policy_type" { + description = "Type of the route filter policy. Should be one of: BGP_IPv4_PREFIX_FILTER, BGP_IPv6_PREFIX_FILTER" + type = string +} + +variable "route_filter_policy_description" { + description = "Description of the route filter policy you're creating" + type = string + default = "" +} + +variable "route_filter_rules" { + description = "List of route filter rules to add to the created route filter policy" + type = list(object({ + prefix = string, + name = optional(string), + description = optional(string), + prefix_match = optional(string), + })) +} + +variable "connection_route_filter_direction" { + description = "Direction [INBOUND or OUTBOUND] that the route filter policy is applied to for the connection" + type = string +} + +variable "connection_id" { + description = "Id of the Fabric connection you want to attach the route filter policy to" + type = string +} +``` + + #outputs.tf +```hcl + +``` + + #main.tf +```hcl +resource "equinix_fabric_route_filter" "policy" { + name = var.route_filter_policy_name + project { + project_id = var.route_filter_policy_project_id + } + type = var.route_filter_policy_type + description = var.route_filter_policy_description != "" ? var.route_filter_policy_description : null +} + +resource "equinix_fabric_route_filter_rule" "this" { + for_each = { + for index, rule in var.route_filter_rules: + rule.prefix => rule + } + route_filter_id = equinix_fabric_route_filter.policy.id + name = each.value.name != "" ? each.value.name : null + description = each.value.description != "" ? each.value.description : null + prefix = each.value.prefix + prefix_match = each.value.prefix_match != "" ? each.value.prefix_match : null +} + + +resource "equinix_fabric_connection_route_filter" "attachment" { + depends_on = [ equinix_fabric_route_filter_rule.this ] + connection_id = var.connection_id + route_filter_id = equinix_fabric_route_filter.policy.id + direction = var.connection_route_filter_direction +} + +``` + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.5.4 | +| [equinix](#requirement\_equinix) | >= 2.8.0 | + +## Providers + +| Name | Version | +|------|---------| +| [equinix](#provider\_equinix) | >= 2.8.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [equinix_fabric_connection_route_filter.attachment](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/fabric_connection_route_filter) | resource | +| [equinix_fabric_route_filter.policy](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/fabric_route_filter) | resource | +| [equinix_fabric_route_filter_rule.this](https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/fabric_route_filter_rule) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [connection\_id](#input\_connection\_id) | Id of the Fabric connection you want to attach the route filter policy to | `string` | n/a | yes | +| [connection\_route\_filter\_direction](#input\_connection\_route\_filter\_direction) | Direction [INBOUND or OUTBOUND] that the route filter policy is applied to for the connection | `string` | n/a | yes | +| [route\_filter\_policy\_description](#input\_route\_filter\_policy\_description) | Description of the route filter policy you're creating | `string` | `""` | no | +| [route\_filter\_policy\_name](#input\_route\_filter\_policy\_name) | Name of the route filter policy that will be created in this module | `string` | n/a | yes | +| [route\_filter\_policy\_project\_id](#input\_route\_filter\_policy\_project\_id) | Project id where the route filter policy will be created. Should match the project id of the connection you would like to attach the route filter policy to | `string` | n/a | yes | +| [route\_filter\_policy\_type](#input\_route\_filter\_policy\_type) | Type of the route filter policy. Should be one of: BGP\_IPv4\_PREFIX\_FILTER, BGP\_IPv6\_PREFIX\_FILTER | `string` | n/a | yes | +| [route\_filter\_rules](#input\_route\_filter\_rules) | List of route filter rules to add to the created route filter policy |
list(object({
prefix = string,
name = optional(string),
description = optional(string),
prefix_match = optional(string),
}))
| n/a | yes | + +## Outputs + +No outputs. + \ No newline at end of file