A simple way to spawn ubuntu VMs
$ terraform init
# see minimal variables below
$ terraform plan
$ terraform apply
minimal variables needed to run
$ cat < EOF > terraform.tfvars
hostname = " server1"
domainname = " example.com"
EOF
terraform workspace new server1.example.com
terraform workspace select server1.example.com
terraform apply -var=" hostname=server1" -var=" domainname=example.com"
terraform-docs markdown table --output-file README.md --output-mode inject .
No modules.
Name
Description
Type
Default
Required
autostart
autostart vm (default false)
bool
false
no
domainname
domainname used to generate fqdn for cloud-init
string
n/a
yes
hostname
hostname used in filenames + cloud-init
string
n/a
yes
image_release
image release name used in filenames + image_url regex replace (default focal)
string
"focal"
no
image_url
cloud-images URL %RELEASE% will be regex replaced with $image_release (default ubuntu cloud-images)
string
"https://cloud-images.ubuntu.com/%RELEASE%/current/%RELEASE%-server-cloudimg-amd64.img"
no
libvirt_uri
libvirt connection uri
string
"qemu:///system"
no
networks
list of network bridges to attach to (default virbr0)
list(string)
[ "virbr0" ]
no
ssh_public_key
ssh public keyfile for cloud-init (default ~/.ssh/id_rsa.pub)
string
"~/.ssh/id_rsa.pub"
no
username
username for cloud-init
string
"ubuntu"
no
vcpu
vCPUs of the VM (default 1)
number
1
no
volume_data_enabled
volume for data disk enabled? (default false)
bool
false
no
volume_format
volume file format, used for cloud-images + local files (default qcow2)
string
"qcow2"
no
volume_pool
volume pool to save local files to (default default)
string
"default"
no
volume_size_data
volume size for data disk (default 50GB)
number
53687091200
no
volume_size_root
volume size for root disk (default 10GB)
number
10737418240
no
vram
RAM of the VM (default 2GB)
number
2048
no
No outputs.