Files
hunfabric/modules/cloud-config-container/simple-nva
Simone Ruffilli 3e5c0b5ca7 Simple NVA - Fixes race condition
Prevents a race condition where the Google agent creates the local route for the LB VIP only after this script has been run
2022-12-15 11:02:24 +01:00
..
2022-12-15 11:02:24 +01:00
2022-10-25 15:04:38 +02:00
2022-12-10 15:40:15 +01:00
2022-11-21 13:17:55 +01:00

Google Simple NVA Module

This module allows for the creation of a NVA (Network Virtual Appliance) to be used for experiments and as a stub for future appliances deployment.

This NVA can be used to interconnect up to 8 VPCs.

Examples

Simple example

locals {
  network_interfaces = [
    {
      addresses  = null
      name       = "dev"
      nat        = false
      network    = "dev_vpc_self_link"
      routes     = ["10.128.0.0/9"]
      subnetwork = "dev_vpc_nva_subnet_self_link"
    },
    {
      addresses  = null
      name       = "prod"
      nat        = false
      network    = "prod_vpc_self_link"
      routes     = ["10.0.0.0/9"]
      subnetwork = "prod_vpc_nva_subnet_self_link"
    }
  ]
}

module "cos-nva" {
  source               = "./fabric/modules/cloud-config-container/simple-nva"
  enable_health_checks = true
  network_interfaces   = local.network_interfaces
  # files = {
  #   "/var/lib/cloud/scripts/per-boot/firewall-rules.sh" = {
  #     content     = file("./your_path/to/firewall-rules.sh")
  #     owner       = "root"
  #     permissions = 0700
  #   }
  # }
}

module "vm" {
  source             = "./fabric/modules/compute-vm"
  project_id         = "my-project"
  zone               = "europe-west8-b"
  name               = "cos-nva"
  network_interfaces = local.network_interfaces
  metadata = {
    user-data              = module.cos-nva.cloud_config
    google-logging-enabled = true
  }
  boot_disk = {
    image = "projects/cos-cloud/global/images/family/cos-stable"
    type  = "pd-ssd"
    size  = 10
  }
  tags = ["nva", "ssh"]
}
# tftest modules=1 resources=1

Variables

name description type required default
network_interfaces Network interfaces configuration. list(object({…}))
cloud_config Cloud config template path. If null default will be used. string null
enable_health_checks Configures routing to enable responses to health check probes. bool false
files Map of extra files to create on the instance, path as key. Owner and permissions will use defaults if null. map(object({…})) {}

Outputs

name description sensitive
cloud_config Rendered cloud-config file to be passed as user-data instance metadata.