Are there plans for a Terraform provider? I am looking to manage a fleet in Terraform (IaC).
Hi @nmcauliffe
Not sure I understand your question correctly - are you talking about deploying OpenBalena using Terraform?
No, I’m looking for something I can use to configure Balena Cloud - apps, devices, orgs, etc. But it should be usable for any installation with an host name configuration parameter.
Hi
Thanks for getting back. We would love to understand a bit more; what use case TF helps with ? This will help us identify if there is a gap on Balena Cloud Dashboard|CLI.
There is no way to manage the fleet, org, or apps using IaC. I would like to define everything possible as code and then use something like TF to deploy it.
Thanks. We have created a Product item to prioritize for IaC management of fleet via Terraform.
One question: The devices are something as first level concept (more like pets not cattle) where the management piece comes at play. I think the IaC has always given more importance to structure and associated software rather than actual devices (count), do you have a use case on similar lines? i.e. we care about the required number of devices running the desired software on them rather than all actual devices in the system.
For what I was looking at this for, we would care more about the pets part. My initial thought was a device
resource that would be attached to an app
resource.
Let me know if you need any more info.
device
resource attributes would need to include the zip link and configuration file link.
Hey @nmcauliffe, a question. What exactly do you mean by a zip link and configuration file link for the device? Do you mean a link to an image for flashing the device and a link to a config file for the device? I’m not personally extremely familiar with Terraform, although other team members are. I’m asking so that we can capture as much as possible of your request.
If my understanding above is correct, I’m not sure how how that would map exactly to the way Balena works. Devices do not have an image specific to the individual device somewhere on the cloud. Neither do they have a config file per se. Devices are flashed with an image that is preconfigured to point to your application / fleet. The configuration is managed between the device itself and Balena cloud. (There is a config file that lives on the device only that controls some specific things, but does not control the device state)
Please let me know if I’m on the right track or not.
@toochevere When you add a new device, there are downloads for the OS and config files you mentioned. Those are what I would expect to be in the device attributes.
Hi @nmcauliffe, defining a device as a “device resource” would seem like preregistering a device into the fleet. The JSON configuration file for that device could then be retrieved from the attributes, written to a JSON text file, and used with the balena CLI to configure & flash an image. On the other hand, there can be a “fleet data source” that allows you to obtain the same configuration file but not specific to a device UUID and does not pre-register any device. Let us know what you think about this approach.
We don’t have existing plans or resources to support Terraform for balenaCloud. We also have to consider that this should support openBalena as well. However, we do allow community members to take over projects like these and we may help give guidance in making sure that it works well with the balena ecosystem.
I think both the fleet
and device
resource could be helpful depending on the scenario.
- Example 1: Deploying a fleet of cattle that behave more like an auto scaling group.
- Example 2: Deploying a fleet of pets that are assigned specific sites.
Bump
Keen to get the skinny on Terraforming all-the-Balena-things
Hopefully things have moved on
I don’t see it’s getting better. Let’s say I want to start writing tf-balena-provider.
Would it make sense to use balena org for that? or a public repo should suffice licence-wise?