Terraform (bpg/proxmox) provisions two Ubuntu 24.04 cloud-init VMs on a Proxmox host, one running obmp-docker's `deploy.sh --scope full-stack` and the other running GoBGP as a BMP-source stand-in. `scripts/run-test.sh` runs the six assertions from docs/design.md (containers healthy, BMP peer up, ip_rib/bgp_peers non-zero, Grafana healthcheck). Layout: terraform/ provider + VM + cloud-init snippet resources terraform/cloud-init/ user-data templates (store + bmpgen) scripts/ run-test.sh, teardown.sh docs/design.md topology, assertion set, and rationale Cred handling: terraform.tfvars is gitignored; endpoint + api_token can also come from PROXMOX_VE_ENDPOINT / PROXMOX_VE_API_TOKEN env vars. Not validated locally: `terraform init && terraform validate` -- the terraform binary is not on the authoring host. YAML + shell + HCL brace balance verified. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
183 lines
5.2 KiB
HCL
183 lines
5.2 KiB
HCL
############################################################################
|
|
# Proxmox connection
|
|
############################################################################
|
|
|
|
variable "pve_endpoint" {
|
|
description = "Proxmox VE API endpoint, e.g. https://pve.lab.example:8006/"
|
|
type = string
|
|
}
|
|
|
|
variable "pve_api_token" {
|
|
description = "PVE API token in the form USER@REALM!TOKENID=UUID"
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "pve_insecure" {
|
|
description = "Skip TLS verification for the PVE API (lab / self-signed only)"
|
|
type = bool
|
|
default = false
|
|
}
|
|
|
|
variable "pve_ssh_username" {
|
|
description = "Username the provider uses for PVE SSH-side operations (snippet uploads)"
|
|
type = string
|
|
default = "root"
|
|
}
|
|
|
|
variable "pve_node" {
|
|
description = "PVE node name to schedule VMs on (as shown in the PVE cluster tree)"
|
|
type = string
|
|
}
|
|
|
|
############################################################################
|
|
# VM shape
|
|
############################################################################
|
|
|
|
variable "store_vm_id" {
|
|
description = "PVE VMID for the OBMP store VM"
|
|
type = number
|
|
default = 9001
|
|
}
|
|
|
|
variable "bmpgen_vm_id" {
|
|
description = "PVE VMID for the GoBGP BMP-source VM"
|
|
type = number
|
|
default = 9002
|
|
}
|
|
|
|
variable "vm_cpu_cores" {
|
|
description = "vCPU count per test VM. Store is IO-bound at ingest, keep to 2-4."
|
|
type = number
|
|
default = 2
|
|
}
|
|
|
|
variable "vm_memory_mb" {
|
|
description = "Memory per VM in MB. 4096 covers the compose stack for a light BMP test."
|
|
type = number
|
|
default = 4096
|
|
}
|
|
|
|
variable "vm_disk_gb" {
|
|
description = "Root disk size per VM in GB. Store needs headroom for postgres/kafka."
|
|
type = number
|
|
default = 32
|
|
}
|
|
|
|
############################################################################
|
|
# Storage + image
|
|
############################################################################
|
|
|
|
variable "vm_storage_pool" {
|
|
description = "PVE storage pool for VM disks, e.g. local-lvm, local-zfs"
|
|
type = string
|
|
}
|
|
|
|
variable "image_storage" {
|
|
description = "PVE storage that holds ISOs / cloud images (typically local)"
|
|
type = string
|
|
default = "local"
|
|
}
|
|
|
|
variable "snippet_storage" {
|
|
description = "PVE storage that supports snippets content type (typically local)"
|
|
type = string
|
|
default = "local"
|
|
}
|
|
|
|
variable "ubuntu_image_url" {
|
|
description = "Ubuntu cloud image URL. Pinned to noble by default; override for a snapshot."
|
|
type = string
|
|
default = "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img"
|
|
}
|
|
|
|
variable "ubuntu_image_checksum" {
|
|
description = "SHA256 of the Ubuntu image. Set to enforce; empty to skip check."
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
############################################################################
|
|
# Network
|
|
############################################################################
|
|
|
|
variable "vm_bridge" {
|
|
description = "PVE Linux bridge the VMs attach to, e.g. vmbr0"
|
|
type = string
|
|
default = "vmbr0"
|
|
}
|
|
|
|
variable "vm_vlan_tag" {
|
|
description = "802.1q VLAN tag; 0 = no tag"
|
|
type = number
|
|
default = 0
|
|
}
|
|
|
|
variable "store_vm_ip_cidr" {
|
|
description = "Static IPv4/CIDR for the store VM, e.g. 10.40.40.220/24. Leave empty for DHCP."
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "bmpgen_vm_ip_cidr" {
|
|
description = "Static IPv4/CIDR for the bmpgen VM, e.g. 10.40.40.221/24. Leave empty for DHCP."
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "vm_gateway" {
|
|
description = "Default gateway for both VMs. Ignored when using DHCP."
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
variable "vm_dns_servers" {
|
|
description = "DNS servers for both VMs. Ignored when using DHCP."
|
|
type = list(string)
|
|
default = ["1.1.1.1", "8.8.8.8"]
|
|
}
|
|
|
|
############################################################################
|
|
# SSH access
|
|
############################################################################
|
|
|
|
variable "ssh_public_key_path" {
|
|
description = "Path to the public key that will be authorized on both VMs' ubuntu user."
|
|
type = string
|
|
default = "~/.ssh/id_rsa.pub"
|
|
}
|
|
|
|
variable "ssh_username" {
|
|
description = "Cloud-init user created on both VMs (has passwordless sudo, ssh key auth)."
|
|
type = string
|
|
default = "ubuntu"
|
|
}
|
|
|
|
############################################################################
|
|
# obmp-docker under test
|
|
############################################################################
|
|
|
|
variable "obmp_repo_url" {
|
|
description = "obmp-docker repo URL to clone on the store VM."
|
|
type = string
|
|
default = "http://10.40.40.143:3000/sam/obmp-docker.git"
|
|
}
|
|
|
|
variable "obmp_repo_ref" {
|
|
description = "Git ref (branch, tag, or commit) to check out on the store VM. Pin this for reproducibility."
|
|
type = string
|
|
default = "deploy-refinement"
|
|
}
|
|
|
|
variable "router_facing_port" {
|
|
description = "BMP port routers connect to. Defaults to 1790 (IANA BMP port); mirrors obmp-docker .env."
|
|
type = number
|
|
default = 1790
|
|
}
|
|
|
|
variable "test_local_asn" {
|
|
description = "AS number the GoBGP-side stand-in router uses. Private (64512-65534)."
|
|
type = number
|
|
default = 65099
|
|
}
|