cloud-foundation-fabric/modules/net-interconnect-attachment...
dsiviglia f3901fc567
module for VLAN attachment+cloud router+bgp (#254)
* module for VLAN attachment+cloud router+bgp

* fix vlan attachments review comments

* run terraform fmt

* fix code review comment and build errors

* fix for code review comments

* code review changes

* changes after review

* changes after code review

* changes after code review
2021-06-16 13:56:40 +02:00
..
README.md module for VLAN attachment+cloud router+bgp (#254) 2021-06-16 13:56:40 +02:00
main.tf module for VLAN attachment+cloud router+bgp (#254) 2021-06-16 13:56:40 +02:00
outputs.tf module for VLAN attachment+cloud router+bgp (#254) 2021-06-16 13:56:40 +02:00
variables.tf module for VLAN attachment+cloud router+bgp (#254) 2021-06-16 13:56:40 +02:00
versions.tf module for VLAN attachment+cloud router+bgp (#254) 2021-06-16 13:56:40 +02:00

README.md

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

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
  }
}
# tftest:modules=1:resources=4

Direct Interconnect VLAN attachments to achieve 99.9% SLA setup

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"]
  }
}
# tftest:modules=2:resources=8

Variables

name description type required default
interconnect URL of the underlying Interconnect object that this attachment's traffic will traverse through. string
peer Peer Ip address and asn. Only IPv4 supported object({...})
project_id The project containing the resources string
bgp Bgp session parameters object({...}) null
config VLAN attachment parameters: description, vlan_id, bandwidth, admin_enabled, interconnect object({...}) ...
name The name of the vlan attachment string vlan-attachment
region Region where the router resides string europe-west1-b
router_config Router asn and custom advertisement configuration, ip_ranges is a map of address ranges and descriptions.. object({...}) ...
router_create Create router. bool true
router_name 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. string router-vlan-attachment
router_network A reference to the network to which this router belongs string null

Outputs

name description sensitive
bgpsession bgp session
interconnect_attachment interconnect attachment
router Router resource (only if auto-created).