A Terraform module to create virtual machines and cloudinit based configuration (AWS EC2 style).
This project has been created to launch servers on Virtualbox in an AWS EC2 style.
Project uses:
- Terraform version: >= 0.12
- Virtualbox
- Virtual machines creation
- Disk image VDI format
- Cloudinit OS configuration
- Forwards port 222? to machines
Project is: in progress
See also examples folder.
Use the module in your TF root project
# amzn2.tf:
module "amzn2" {
source = "github.com/philipsahli/terraform-module-virtualbox-cloudinit"
vm_name = var.vm_name
vm_count = var.vm_count
vdi = var.vdi
userdata = var.userdata
}
Define variables for your setup.
# terraform.tfvars:
vm_name = "node"
vm_count = 2
vdi = "https://cdn.amazonlinux.com/os-images/2.0.20190823.1/virtualbox/amzn2-virtualbox-2.0.20190823.1-x86_64.xfs.gpt.vdi"
userdata = <<EOF
#cloud-config
#vim:syntax=yaml
users:
# A user by the name `ec2-user` is created in the image by default.
- default
chpasswd:
list: |
ec2-user:plain_text_password
# In the above line, do not add any spaces after 'ec2-user:'.
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEkNFRkip9a16pc+nwWTUiMcSxePRCNw1PrylLMpnyKo5pT/ user@station
EOF
Variable | Type | Example | Default |
---|---|---|---|
vm_name | string | node | - |
vm_count | int | 2 | 1 |
userdata | string | #cloud-config #vim:syntax=yaml users: - default |
- |
At the moment the module does not output any variable.
Created by @philipsahli - feel free to contact me!