multipass icon indicating copy to clipboard operation
multipass copied to clipboard

terraform provider for multipass

Open reegnz opened this issue 5 years ago • 11 comments

What are you trying to do? I want to use multipass with terraform:

  • launch instances (with or without cloud-init)
  • query instance info
  • list available instances
  • mount a host directory into an instance

What's your proposed solution? Make a terraform provider that implements terraform resources and data sources for multipass.

Additional context If multipass is supposed to be a 'small cloud deployment on your laptop or workstation' then one should be able to use de-facto standard cloud provisioning tools like terraform (or pulumi, using a terraform provider) with it.

reegnz avatar Dec 17 '20 15:12 reegnz

FYI a comparable project for a terraform provider is the libvirt provider: https://github.com/dmacvicar/terraform-provider-libvirt

So I can already manage VM-s on linux with that provider, I would like to use multipass though, since it also works on macos and windows.

reegnz avatar Dec 17 '20 15:12 reegnz

I agree. I would like to have a Provider supports Multipass on my laptop

eandtsa avatar Apr 02 '21 14:04 eandtsa

I am not really well versed in terraform providers but from my understanding it needs to connect to an API which multipass lacks AFAIK so instead I managed to create a terraform module managing multipass https://github.com/roiterorh/multipass-terraform it works but still need some improvement as there is no update on ressources FTM

roiterorh avatar May 17 '21 10:05 roiterorh

Providers don't need an API to call, they just need to PROVIDE an API towards terraform. Eg. you can create files with it:, there's no API per-se for that one. https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file

Right now I'm trying to fill in the gap with https://registry.terraform.io/providers/scottwinkler/shell/latest/docs for tools that don't have an official provider.

reegnz avatar May 18 '21 10:05 reegnz

Yes, a terraform provider for multipass would be great!

blackdogbarking avatar Sep 03 '21 15:09 blackdogbarking

any updates on this one perhaps ?

xinity avatar Jan 07 '22 10:01 xinity

@xinity, @all, this is probably not the right place for this. We have no relationship with terraform, it's the community there you'd need to get behind this idea. We're all for it here :)

Saviq avatar Jan 10 '22 19:01 Saviq

Let's try then 😁

xinity avatar Jan 10 '22 21:01 xinity

I came here in search of such a provider, and meanwhile found https://github.com/larstobi/terraform-provider-multipass which seems promising. There are a few missing features there, so if anyone is interested, we could redirect some love towards that project, instead of waiting for a new one to emerge.

matpen avatar Dec 20 '22 14:12 matpen

For anyone still interested in a Terraform provider for Multipass with more features, I ended up rolling my own.

GitHub: https://github.com/todoroff/terraform-provider-multipass
Terraform Registry: https://registry.terraform.io/providers/todoroff/multipass/latest

It supports:

  • multiple NICs and host mounts at launch
  • inline, file-based, or template-based cloud-init
  • managing named snapshots as first-class resources (create/delete/import)
  • creating aliases as resources for ergonomic CLI entry points
  • file upload/download using resource semantics (no ad-hoc provisioners needed)
  • auto-recovery for instances soft-deleted outside of Terraform
  • inspecting instances, images, networks, and snapshots via data sources

todoroff avatar Nov 18 '25 11:11 todoroff

Impressive stuff @todoroff, thanks for sharing!

ricab avatar Nov 18 '25 13:11 ricab