51 lines
1.7 KiB
Terraform
Raw Permalink Normal View History

# 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
}