Terraform + Chef + ONTAP Cloud
About a month ago, I spoke with a long time friend and we discussed the current challenges of automating NetApp’s ONTAP Cloud. Specifically, I pointed out that there had to be a better way to handle the provisioning of new systems. Currently, I have to pre-provision these ONTAP Cloud for AWS machines and then I can use them in my provisioning process with CHEF. The downside to this is yet another script (Python in this case) that I need to support. I started thinking about the options and how could I streamline the delivery of ONTAP Cloud into a more DevOps style model. You know the model and the hyped-up buzzword – Infrastructure as Code.
The truth is that the term Infrastructure as Code gets a bad wrap. I have a client that winces anytime someone uses the term Idempotent. This is exactly what I need though. I want to be able to provision 1 or 100 ONTAP Cloud systems the same way and never worry about my scripts breaking. More importantly, I need to integrate ONTAP Cloud into the solution and not make it an after thought. So I set about to create a new CHEF cookbook to manage and keep up OnCommand Cloud Manager and ONTAP Cloud systems.
Over the course of the month, I went back and forth and made a ton of changes (oh if you could only see the several times that I rebased or blew away an entire branch). I finally got to the point where the solution worked well. I could deploy OnCommand Cloud Manager locally or into my VPC in AWS and start the launch of a ONTAP Cloud system. Once I created this, I simply needed a way to manage deleting and, most importantly, waiting for the instance state. The final bonus that I included comes from integrating with the NetApp Docker Volume Plug-in (nDVP). I added a recipe and resource to install and configure the nDVP on a Linux host and get all the details about the ONTAP Cloud system via OnCommand Cloud Manager. In a later post, I will talk more about nDVP and ONTAP Cloud and share some example Terraform+Chef configurations.
Eventually, I decided that I needed a better way to handle setting things up in AWS. My first tests leveraged Test-Kitchen but this wouldn’t work for long-term solutions. This is when I decided it was time to test out Terraform into my little project. I had done some minor work with Terraform on an earlier project so I knew that it would be a good fit. In rapid and short order, I had a Terraform template built for all of my infrastructure and to my delight, everything worked well. I was able to plug the Terraform template into my CHEF server and bootstrap the new infrastructure.
Integration with CHEF does come at a cost and if you don’t have a CHEF server, then you are left out in the cold. I decided that I would instead write a bash script that will do the self-bootstrap using chef-solo instead of CHEF Server. This way, you can simply run the command terraform apply and automagically it builds your infrastructure and applies your configuration.
The real benefit of this new solution comes from its modularity and dare I say idempotent. If the ONTAP Cloud system already exists then no problem. As the repository matures, I will include things like power state management, managing tenants and users, and a whole slew of other options. Please leave your opinion or suggestions.
Now, what does DevOps’n with NetApp look like for you?
Would you like to get started using this code? I open-sourced it and made it available below.
I received a few questions and comments offline regarding the CHEF component to this integration. I want to clarify that no CHEF infrastructure is required to deploy this solution. The Terraform template leverages chef-solo integration and self-deploys the cookbooks. The decision to offer CHEF integration is based on my experience with the solution and existing requirements by clients. Happy coding!