2021-06-16 04:56:40 -07:00
# Direct Interconnect VLAN Attachment and router
This module allows creation of a VLAN attachment for Direct Interconnect and router (router creation is optional).
## Examples
### Direct Interconnect VLAN attachment using default parameters for bgp session and router
```hcl
module "vlan-attachment-1" {
source = "./modules/net-interconnect-attachment-direct"
project_id = "dedicated-ic-5-8492"
region = "us-west2"
router_network = "myvpc"
name = "vlan-604-x"
interconnect = "https://www.googleapis.com/compute/v1/projects/mylab/global/interconnects/mylab-interconnect-1"
peer = {
ip_address = "169.254.63.2"
asn = 65418
}
}
2022-01-28 11:15:35 -08:00
# tftest modules=1 resources=4
2021-06-16 04:56:40 -07:00
```
#### Direct Interconnect VLAN attachments to achieve 99.9% SLA setup
```hcl
module "vlan-attachment-1" {
source = "./modules/net-interconnect-attachment-direct"
project_id = "dedicated-ic-3-8386"
region = "us-west2"
router_name = "router-1"
router_config = {
description = ""
asn = 65003
advertise_config = {
groups = ["ALL_SUBNETS"]
ip_ranges = {
"199.36.153.8/30" = "custom"
}
mode = "CUSTOM"
}
}
router_network = "myvpc"
name = "vlan-603-1"
interconnect = "https://www.googleapis.com/compute/v1/projects/mylab/global/interconnects/mylab-interconnect-1"
config = {
description = ""
vlan_id = 603
bandwidth = "BPS_10G"
admin_enabled = true
mtu = 1440
}
peer = {
ip_address = "169.254.63.2"
asn = 65418
}
bgp = {
session_range = "169.254.63.1/29"
advertised_route_priority = 0
candidate_ip_ranges = ["169.254.63.0/29"]
}
}
module "vlan-attachment-2" {
source = "./modules/net-interconnect-attachment-direct"
project_id = "dedicated-ic-3-8386"
region = "us-west2"
router_name = "router-2"
router_config = {
description = ""
asn = 65003
advertise_config = {
groups = ["ALL_SUBNETS"]
ip_ranges = {
"199.36.153.8/30" = "custom"
}
mode = "CUSTOM"
}
}
router_network = "myvpc"
name = "vlan-603-2"
interconnect = "https://www.googleapis.com/compute/v1/projects/mylab/global/interconnects/mylab-interconnect-2"
config = {
description = ""
vlan_id = 603
bandwidth = "BPS_10G"
admin_enabled = true
mtu = 1440
}
peer = {
ip_address = "169.254.63.10"
asn = 65418
}
bgp = {
session_range = "169.254.63.9/29"
advertised_route_priority = 0
candidate_ip_ranges = ["169.254.63.8/29"]
}
}
2022-01-28 11:15:35 -08:00
# tftest modules=2 resources=8
2021-06-16 04:56:40 -07:00
```
<!-- BEGIN TFDOC -->
2021-12-20 23:51:51 -08:00
2021-06-16 04:56:40 -07:00
## Variables
| name | description | type | required | default |
2021-12-20 23:51:51 -08:00
|---|---|:---:|:---:|:---:|
2022-01-22 04:34:35 -08:00
| [interconnect ](variables.tf#L46 ) | URL of the underlying Interconnect object that this attachment's traffic will traverse through. | < code > string</ code > | ✓ | |
2022-01-31 01:45:34 -08:00
| [peer ](variables.tf#L57 ) | Peer Ip address and asn. Only IPv4 supported. | < code title = "object({ ip_address = string asn = number })" > object({…}) </ code > | ✓ | |
| [project_id ](variables.tf#L65 ) | The project containing the resources. | < code > string</ code > | ✓ | |
| [router_config ](variables.tf#L76 ) | Router asn and custom advertisement configuration, ip_ranges is a map of address ranges and descriptions.. . | < code title = "object({ description = string asn = number advertise_config = object({ groups = list(string) ip_ranges = map(string) mode = string }) }) default = { description = null asn = 64514 advertise_config = null }" > object({…} </ code > | ✓ | |
| [bgp ](variables.tf#L17 ) | Bgp session parameters. | < code title = "object({ session_range = string candidate_ip_ranges = list(string) advertised_route_priority = number })" > object({…}) </ code > | | < code > null</ code > |
| [config ](variables.tf#L28 ) | VLAN attachment parameters: description, vlan_id, bandwidth, admin_enabled, interconnect. | < code title = "object({ description = string vlan_id = number bandwidth = string admin_enabled = bool mtu = number })" > object({…}) </ code > | | < code title = "{ description = null vlan_id = null bandwidth = "BPS_10G" admin_enabled = true mtu = 1440 }" > {…} </ code > |
| [name ](variables.tf#L51 ) | The name of the vlan attachment. | < code > string</ code > | | < code > " vlan-attachment" </ code > |
| [region ](variables.tf#L70 ) | Region where the router resides. | < code > string</ code > | | < code > " europe-west1-b" </ code > |
2022-01-22 04:34:35 -08:00
| [router_create ](variables.tf#L95 ) | Create router. | < code > bool</ code > | | < code > true</ code > |
| [router_name ](variables.tf#L101 ) | Router name used for auto created router, or to specify an existing router to use if `router_create` is set to `true` . Leave blank to use vlan attachment name for auto created router. | < code > string</ code > | | < code > " router-vlan-attachment" </ code > |
2022-01-31 01:45:34 -08:00
| [router_network ](variables.tf#L107 ) | A reference to the network to which this router belongs. | < code > string</ code > | | < code > null</ code > |
2021-06-16 04:56:40 -07:00
## Outputs
| name | description | sensitive |
|---|---|:---:|
2022-01-31 01:45:34 -08:00
| [bgpsession ](outputs.tf#L16 ) | bgp session. | |
| [interconnect_attachment ](outputs.tf#L21 ) | interconnect attachment. | |
2022-01-22 04:34:35 -08:00
| [router ](outputs.tf#L26 ) | Router resource (only if auto-created). | |
2021-12-20 23:51:51 -08:00
2021-06-16 04:56:40 -07:00
<!-- END TFDOC -->