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>
51 lines
1.7 KiB
HCL
51 lines
1.7 KiB
HCL
# Outputs feed the run-test.sh wrapper (jq consumes `terraform output -json`)
|
|
# and give the operator sane next-step hints after `apply`.
|
|
|
|
output "store_vm_ip" {
|
|
description = "IPv4 the store VM will be reachable on."
|
|
value = var.store_vm_ip_cidr != "" ? split("/", var.store_vm_ip_cidr)[0] : (
|
|
length(proxmox_virtual_environment_vm.store.ipv4_addresses) > 1 ?
|
|
proxmox_virtual_environment_vm.store.ipv4_addresses[1][0] : ""
|
|
)
|
|
}
|
|
|
|
output "bmpgen_vm_ip" {
|
|
description = "IPv4 the bmpgen VM will be reachable on."
|
|
value = var.bmpgen_vm_ip_cidr != "" ? split("/", var.bmpgen_vm_ip_cidr)[0] : (
|
|
length(proxmox_virtual_environment_vm.bmpgen.ipv4_addresses) > 1 ?
|
|
proxmox_virtual_environment_vm.bmpgen.ipv4_addresses[1][0] : ""
|
|
)
|
|
}
|
|
|
|
output "ssh_username" {
|
|
description = "SSH username cloud-init provisioned on both VMs."
|
|
value = var.ssh_username
|
|
}
|
|
|
|
output "grafana_url" {
|
|
description = "Grafana URL once deploy.sh finishes on the store VM."
|
|
value = format("http://%s:3000/grafana/",
|
|
var.store_vm_ip_cidr != "" ? split("/", var.store_vm_ip_cidr)[0] : "<store_ip>"
|
|
)
|
|
}
|
|
|
|
output "next_steps" {
|
|
description = "What to do after apply."
|
|
value = <<-EOT
|
|
Cloud-init on both VMs runs for ~5-10 minutes after apply completes.
|
|
Poll the store VM until it's up, then run the assertions:
|
|
|
|
../scripts/run-test.sh
|
|
|
|
To iterate on the terraform without rebuilding the VMs:
|
|
|
|
terraform apply -target=proxmox_virtual_environment_file.store_cloud_init
|
|
# then reset the VM: qm shutdown <vmid> && qm start <vmid>
|
|
# (cloud-init re-runs the snippet at next boot only if you touch it)
|
|
|
|
To tear down:
|
|
|
|
../scripts/teardown.sh
|
|
EOT
|
|
}
|