Replies: 2 comments 1 reply
-
I think it's a good idea. We evoked already internally the idea of an ansible plugin to declare things for instance. Wouldn't an ansible plugin make more sense than a terraform one? Given that terraform is more for resources in cloud provider and ansible is more about service configuration provisioning. |
Beta Was this translation helpful? Give feedback.
-
@din14970 I would certainly be interested in this and perhaps contributing (although I know little about terraform and ansible). We have been working with a research group here on expressing their templates in a simplified JSONSchema representation, which allows for validation of the metadata entered by users. It also allows them to version their template structures with more detail. I was hoping eventually to write a converter that could automatically transform from our JSONSchema to eLabFTW template definitions automatically, but that would be in the future. |
Beta Was this translation helpful? Give feedback.
-
In the context of my previous post I wrote a Python library that wraps elabapi-python for declaratively defining templates, items and other eLabFTW resources. The idea behind it was that I could define resources using YAML files, which I could then "apply" to the instance. Instead of modifying things on the fly either with the API or through the UI, a declarative approach to managing resources in eLabFTW would allow an administrator or user to manage system state through git and CI/CD. The main reason I wanted this is because the team I was working with could not decide on their data model which made making changes very cumbersome.
As I was developing the library, the more I discovered I was reinventing terraform in Python (though using YAML as config language instead of HCL). This precipitated in me the idea that perhaps it would be a better idea to shift my efforts to writing a terraform provider for eLabFTW. These days many popular services with an API have terraform providers, which allows platform engineers to not only manage cloud resources declaritively, but also the configuration/state of the services inside the same code base. I'm also sure that with a terraform provider, eLabFTW would be considered much more seriously by engineering/ops teams.
Terraform providers are stand-alone executables written in golang that act as an intermediary between terraform itself on the one hand and the API client on the other hand. Terraform talks to it through grpc, and the provider makes the API calls through the client library. Since eLabFTW has an OpenAPI specification, it is trivial to generate a Go client SDK (I tried it locally following the template in the elabapi-python repo). Writing a provider would involve wrapping this SDK according to the guide. It is something I would like to take a stab at, but I must admit I have 0 experience with golang so it will also be a learning process. I have heard that golang is an easy language which makes me hopeful I can figure it out; however it will take some time.
I wanted to post this here both to get feedback on the idea and see if anyone wants to contribute to the project. I was thinking to first create the repos (provider and go client) under my personal github account and if you see value in supporting it "officially" to move them under the elabftw organization.
Beta Was this translation helpful? Give feedback.
All reactions