TofuLibVirt/vm-infrastructure/README.md

51 lines
1.0 KiB
Markdown

# VM Infrastructure with OpenTofu + LibVirt
This project provisions virtual machines using OpenTofu and LibVirt.
## Quick Start
```bash
# Initialize OpenTofu
tofu init
# Plan deployment
tofu plan
# Deploy VMs
tofu apply
# Get VM IPs
tofu output vm_ips
# Destroy infrastructure when done
tofu destroy
```
## Configuration
- **VMs**: 3 Ubuntu 22.04 VMs with 4GB RAM, 2 vCPUs, 30GB disk each
- **Authentication**: SSH key-based (no password auth)
- **User**: `ubuntu` with sudo access
- **Network**: Default libvirt network with DHCP
## Files
- `main.tf` - Main infrastructure configuration
- `variables.tf` - Input variables
- `outputs.tf` - Output values (VM IPs and names)
- `terraform.tfvars` - Variable values
- `cloud-init/` - VM initialization configuration
## Prerequisites
1. Install LibVirt and OpenTofu (see main PLAN.md)
2. Ensure your SSH public key is in `cloud-init/user-data.yaml`
3. User must be in `libvirt` group
## Accessing VMs
```bash
# SSH to VM (replace with actual IP)
ssh ubuntu@192.168.122.100
```