Skip to content

Nyariki/Terraform-Multipass-With-Cloud-Init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Terraform config for quickly spinning up Multipass VMs. It builds on the efforts of this project.

This setup allows us to define a cloud-init template, which will help us add such things as users, groups, startup commands, ssh keys for access, etc. to the VMs.

Requirements

  1. Terraform.
  2. Groovy.
  3. Multipass.
  4. SSH-Keygen tool, accessible from your console.

Modules

1. Key

The key module manages the SSH keys. For every new VM, a SSH public-private key pair is generated.

The ssh_key resource wraps up calls to a script that creates, reads and deletes the key, according to the resource lifecycle.

2. Config

The config module provides the cloud-init yaml content. It reads from the template file, replaces some placeholders in the template with values from the module, then returns valid cloud-init content.

3. Multipass

The multipass module manages the VM, allowing the name, memory, cpus and disk-space to be customized.

The vm resource wraps up calls to a script that creates, reads and deletes the vm, according to the resource lifecycle.

Testing

Apply the configuration:

terraform init
terraform apply -auto-approve 

Access a VM:

ssh -i multipass/key/keys/id_rsa_test-vm-0 -oStrictHostKeyChecking=no ubuntu@192.168.64.19 

ToDo: Use Terraform to spin up a microk8s cluster entirely on this config.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published