MAAS Terraform Provider

Has anyone else tried this MAAS Terraform provider?

I have gotten it to work, but cannot request RAM or CPUs when I make a node.

https://github.com/Roblox/terraform-provider-maas

1 Like

Yeah for the moment we’ve given up on using TF providers with MaaS and went with the REST api via a python script that terraform calls.

I started to get interested in Juju.

But…

Where are the docs? I found one beginning tutorial and there seemed to be no follow up on charms dev.

The lack of mind share and momentum seems like a concern.

Yes! I’m at Roblox and thus obviously using the above terraform provider. What I would recommend, is you can create smart tags, and then use tags to select which machines to deploy to.

See https://maas.io/docs/cli-tag-management for some background on tag creation. I have done a few smart tags like this:

maas $ENV tags create name=“256GB_RAM” comment=“256GB or more of RAM” definition=’//node[@handle=“DMI:1000”]/“size units”=“bytes” > 270000000000’

maas $ENV tags create name=“E5-2680v4” comment=“Intel® Xeon® CPU E5-2680 v4 @ 2.40GHz” definition=’//node[@id=“cpu:0” and @class=“processor”]/product = “Intel® Xeon® CPU E5-2680 v4 @ 2.40GHz”’

Then you can use tags to select which resources to use as explained in https://github.com/Roblox/terraform-provider-maas#use-tags-to-restrict-deployments-to-specific-nodes

I must confess I haven’t combined these two methods, but I know they work independently, so I think it should work just as well with a dynamic tag as with a static one.

1 Like

Hi @abeeman.

I was hoping I could have my pool of resources in MAAS, which includes a few pods that can be sliced and diced into KVM vms of various sizes and declare in Terraform what I wanted to create without having to precreate the sized boxes before hand. I want even my VM specs to be Infrastructure as Code if possible.

Is that a possibility with the smart tags? Do you have to cut out the boxes ahead of time?

I am using pods because it is convienient. I know one of the main draws of MAAS is you can avoid VMs and go bare metal, but I have 3 small boxes with no board management controller and one box that does have a BMC and IPMI, but it is 64 cores and 64GB memory. I always want to slice and dice that one instead of making one monster bare metal.

I have deployed with the tags to match particular pre-enlisted, commissioned, and deployed machines…

But it’s not the same as the cool stuff Juju does with MAAS. And I just wish I could also get the full power of Terraform out of MAAS here. It looks like a little bit of Go development to bridge that gap.

Hi @db0west the current implementation doesn’t have the power to create KVM VM’s, but we agree this is a desirable feature which should not require a lot of code to do. I cannot promise a timeline yet but I have spoken with one of our architecture leads (who is a strong advocate of both MAAS and Terraform) and I will be putting this in as an RFE in our system. I will reply back to this thread when we have some progress in this direction. Alternatively, if you are interested in taking a stab at it yourself, we would welcome your pull request for consideration; that’s what Open Source is all about!

Maybe it’s not intended or supported… but… if you have a pod with available resources and no ready commissioned boxes it will actually legit make a KVM VM with the following:

provider "maas" {
    api_version = "2.0"
    api_key = "very:secret:api:key:published:on:a:public:discourse:server"
    api_url = "https://super-secure-server-in-the-side-of-a-mountain:5240/MAAS"
}


resource "maas_instance" "maas_terraform" {
  count = 1
}

You can’t choose anything to give it more than the measly 1cpu 1gb mem 5G or whatever it is miserly rationed, but it will make you a box potentially called proper-sloth.

Hi, Any progress around this?

7 months and no replies, so I’m assuming that using MAAS as a provider to terraform isn’t an option.

There is this fork… I do not have MAAS currently installed so I cannot test it…

https://github.com/suchpuppet/terraform-provider-maas

Howdy folks! Thanks for the pointer, I’m starting to take over our MAAS installation and going to leverage our terraform to manage it.

Many of us are rallying to bring back this provider and we now have a few more folks with maintainer access. There are a few questions/calls to action here:

  1. If you’re using this heavily (and maybe made some modifications?) please submit them upstream! While there’s a great base, we still need to build a ton of functionality.
  2. We’re going to move the repo into a separate organization so we can publish to the Terraform Registry. We’re planning to create a new terraform-maas-community org, but if anyone has suggestions (or maybe if this should live in some other org?) please let us know!

Hey folks, excited to see all the interest in a Terraform provider for MAAS!

The MAAS core team is working with the maintainer of this provider to build a new MAAS Terraform provider. It’s rather new and we encourage contributions.

1 Like

@cgrabowski @sparkiegeek (and I’d tag Ionut but I’m not sure of their handle on here) that’s amazing!! :tada:

Would y’all be interested in teaming up? We don’t need to maintain an additional community provider if there’s already going to be one we can all collaborate on together. The main requirement would be to put the provider into an organization (not an individual account) so we can publish it onto the Terraform Registry. I added a few more notes about it here.

I can help take a look at what’s in negronjl/terraform-provider-maas so we can ensure feature parity if so!

Hm, and of course after I hit send…

Thinking about it more, there’s more history/momentum behind the existing provider, did y’all consider converging on that? I don’t feel too strongly, but it might be easier since it’s already got the most mindshare/SEO.

Thanks for the communication over Github.

I did a review of the repo https://github.com/ionutbalutoiu/terraform-provider-maas. It provides some welcome resources: VM support, network management, and some machine management. These would be some great features to pick up.

The Roblox fork (https://github.com/roblox/terraform-provider-maas/) doesn’t have all of these features. But it has been fleshed out pretty well with good documentation. I am in favor of it mostly because of my familiarity with it.

Hi everybody,

we want to start looking into using Terraform with our MaaS instance as well…

I am currently a little confused/overwhelmed by the various “loose ends” with regard to the different TF providers around.

It looks like there is an official Canonical provider (https://github.com/maas/terraform-provider-maas), the negronjil one seemed to have a lot of initial traction and this thread suggests that the “roblox” provider would be the go to version…

In addition to that I discovered yet another (seemingly completely unrelated approach) on the TF registry: https://registry.terraform.io/providers/dan-sullivan/maas/latest/docs

Can anyone give any pointers as to which solution would be the most “promising” one mid-term?

Cheers and best regards,
Thomas

Hi!

Good question. We are aiming to release and maintain the official Canonical provider starting from 3.2. Of course, you are free to use it in the meantime.

Perhaps @sparkiegeek might have some comments on this as well.

Cheers
Anton

1 Like

@tdressen as far as I can tell the TF provider in the registry is just a fork of the official Canonical provider that’s then been published.

It’s referenced in the git repo and Dan has put an issue in on the official provider about publishing that to the registry

@anton5mith will the provider be published to the TF registry in line with the release dates for 3.2, or is it likely to be published before May?

Hi there @algebra-jones.

Unfortunately I made a mistake when I said 3.2, since 3.2 is coming out very soon.

Officially releasing this provider will be in our workstream for 3.3 (22.10 timeframe), which means it will be done during April - October. I can’t promise when during this time period it will be, but I will add a note that we will publish it to the TF registry.

In the meantime, as I understand it this TF provider should be in a working state - but we have not put it through it’s paces ourselves yet.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.