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.

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.