Skip to content

Latest commit

 

History

History
 
 

net-address

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Net Address Reservation Module

This module allows reserving Compute Engine external, global, and internal addresses.

Examples

External and global addresses

module "addresses" {
  source     = "./fabric/modules/net-address"
  project_id = var.project_id
  external_addresses = {
    one = { region = "europe-west1" }
    two = { region = "europe-west2" }
  }
  global_addresses = {
    app-1 = {}
    app-2 = {}
  }
}
# tftest modules=1 resources=4 inventory=external.yaml

Internal addresses

module "addresses" {
  source     = "./fabric/modules/net-address"
  project_id = var.project_id
  internal_addresses = {
    ilb-1 = {
      purpose    = "SHARED_LOADBALANCER_VIP"
      region     = var.region
      subnetwork = var.subnet.self_link
    }
    ilb-2 = {
      address    = "10.0.0.2"
      region     = var.region
      subnetwork = var.subnet.self_link
    }
  }
}
# tftest modules=1 resources=2 inventory=internal.yaml

IPv6 addresses

You can reserve both external and internal IPv6 addresses.

module "addresses" {
  source     = "./fabric/modules/net-address"
  project_id = var.project_id
  external_addresses = {
    nlb = {
      region     = var.region
      subnetwork = var.subnet.self_link
      ipv6 = {
        endpoint_type = "NETLB"
      }
    }
  }
  internal_addresses = {
    ilb = {
      ipv6       = {}
      purpose    = "SHARED_LOADBALANCER_VIP"
      region     = var.region
      subnetwork = var.subnet.self_link
    }
    vm = {
      ipv6       = {}
      region     = var.region
      subnetwork = var.subnet.self_link
    }
  }
}
# tftest modules=1 resources=3 inventory=ipv6.yaml

PSA addresses

module "addresses" {
  source     = "./fabric/modules/net-address"
  project_id = var.project_id
  psa_addresses = {
    cloudsql-mysql = {
      address       = "10.10.10.0"
      network       = var.vpc.self_link
      prefix_length = 24
    }
  }
}
# tftest modules=1 resources=1 inventory=psa.yaml

PSC addresses

module "addresses" {
  source     = "./fabric/modules/net-address"
  project_id = var.project_id
  psc_addresses = {
    one = {
      address = null
      network = var.vpc.self_link
    }
    two = {
      address = "10.0.0.32"
      network = var.vpc.self_link
    }
  }
}
# tftest modules=1 resources=2 inventory=psc.yaml

IPSec Interconnect addresses

module "addresses" {
  source     = "./fabric/modules/net-address"
  project_id = var.project_id
  ipsec_interconnect_addresses = {
    vpn-gw-range-1 = {
      address       = "10.255.255.0"
      region        = var.region
      network       = var.vpc.self_link
      prefix_length = 29
    }
    vpn-gw-range-2 = {
      address       = "10.255.255.8"
      region        = var.region
      network       = var.vpc.self_link
      prefix_length = 29
    }
  }
}
# tftest modules=1 resources=2 inventory=ipsec-interconnect.yaml

Variables

name description type required default
project_id Project where the addresses will be created. string
external_addresses Map of external addresses, keyed by name. map(object({…})) {}
global_addresses List of global addresses to create. map(object({…})) {}
internal_addresses Map of internal addresses to create, keyed by name. map(object({…})) {}
ipsec_interconnect_addresses Map of internal addresses used for HPA VPN over Cloud Interconnect. map(object({…})) {}
psa_addresses Map of internal addresses used for Private Service Access. map(object({…})) {}
psc_addresses Map of internal addresses used for Private Service Connect. map(object({…})) {}

Outputs

name description sensitive
external_addresses Allocated external addresses.
global_addresses Allocated global external addresses.
internal_addresses Allocated internal addresses.
ipsec_interconnect_addresses Allocated internal addresses for HA VPN over Cloud Interconnect.
psa_addresses Allocated internal addresses for PSA endpoints.
psc_addresses Allocated internal addresses for PSC endpoints.